Class AbstractPreparedStatement
- All Implemented Interfaces:
AutoCloseable,PreparedStatement,Statement,Wrapper,FirebirdPreparedStatement,FirebirdStatement,Synchronizable
- Direct Known Subclasses:
FBPreparedStatement
PreparedStatement.- Author:
- David Jencks, Roman Rokytskyy, Mark Rotteveel
-
Nested Class Summary
Nested classes/interfaces inherited from class org.firebirdsql.jdbc.FBStatement
FBStatement.StatementResult -
Field Summary
FieldsFields inherited from class org.firebirdsql.jdbc.FBStatement
completed, connection, currentStatementResult, fbStatement, fetchSize, firstWarning, gdsHelper, isSingletonResult, jdbcVersionSupport, maxRows, specialResult, statementListenerFields inherited from interface org.firebirdsql.jdbc.FirebirdPreparedStatement
TYPE_COMMIT, TYPE_DDL, TYPE_DELETE, TYPE_EXEC_PROCEDURE, TYPE_GET_SEGMENT, TYPE_INSERT, TYPE_PUT_SEGMENT, TYPE_ROLLBACK, TYPE_SELECT, TYPE_SELECT_FOR_UPDATE, TYPE_SET_GENERATOR, TYPE_START_TRANS, TYPE_UPDATEFields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPreparedStatement(GDSHelper c, int rsType, int rsConcurrency, int rsHoldability, FBObjectListener.StatementListener statementListener, FBObjectListener.BlobListener blobListener) Create instance of this class for the specified result set type and concurrency.protectedAbstractPreparedStatement(GDSHelper c, String sql, int rsType, int rsConcurrency, int rsHoldability, FBObjectListener.StatementListener statementListener, FBObjectListener.BlobListener blobListener, boolean metaDataQuery, boolean standaloneStatement, boolean generatedKeys) Create instance of this class and prepare SQL statement. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()voidvoidvoidvoidcompleteStatement(CompletionReason reason) booleanexecute()booleanbooleanbooleanbooleanlongexecuteQuery(String sql) intintexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndex) intexecuteUpdate(String sql, String[] columnNames) Get the execution plan of this PreparedStatementGet the detailed execution plan of this PreparedStatementprotected FBFieldgetField(int columnIndex) Factory method for the field access objectsprotected FieldDescriptorgetParameterDescriptor(int columnIndex) Returns theFieldDescriptorof the specified parameter.intGet the statement type of this PreparedStatement.protected booleaninternalExecute(boolean sendOutParams) Execute this statement.protected booleanprotected voidnotifyStatementCompleted(boolean success) protected voidPrepare fixed statement and initialize parameters.voidfinal voidsetAsciiStream(int parameterIndex, InputStream x) final voidsetAsciiStream(int parameterIndex, InputStream x, int length) final voidsetAsciiStream(int parameterIndex, InputStream x, long length) voidsetBigDecimal(int parameterIndex, BigDecimal x) voidsetBinaryStream(int parameterIndex, InputStream inputStream) voidsetBinaryStream(int parameterIndex, InputStream inputStream, int length) voidsetBinaryStream(int parameterIndex, InputStream inputStream, long length) voidsetBlob(int parameterIndex, InputStream inputStream) voidsetBlob(int parameterIndex, InputStream inputStream, long length) voidvoidsetBoolean(int parameterIndex, boolean x) voidsetByte(int parameterIndex, byte x) voidsetBytes(int parameterIndex, byte[] x) voidsetCharacterStream(int parameterIndex, Reader reader) voidsetCharacterStream(int parameterIndex, Reader reader, int length) voidsetCharacterStream(int parameterIndex, Reader reader, long length) voidvoidvoidvoidvoidvoidsetDouble(int parameterIndex, double x) voidsetFloat(int parameterIndex, float x) voidsetInt(int parameterIndex, int x) voidsetLong(int parameterIndex, long x) voidsetNCharacterStream(int parameterIndex, Reader value) voidsetNCharacterStream(int parameterIndex, Reader value, long length) voidvoidvoidvoidsetNString(int parameterIndex, String value) voidsetNull(int parameterIndex, int sqlType) voidvoidvoidvoidvoidvoidvoidsetShort(int parameterIndex, short x) voidvoidvoidsetStringForced(int parameterIndex, String x) Sets the designated parameter to the given String value.voidvoidvoidsetTimestamp(int parameterIndex, Timestamp x) voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal) voidsetUnicodeStream(int parameterIndex, InputStream x, int length) Deprecated.voidMethods inherited from class org.firebirdsql.jdbc.FBStatement
addWarning, cancel, checkValidity, clearWarnings, close, closeOnCompletion, completeStatement, createStatementListener, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, equals, executeBatch, executeImpl, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, finalize, forgetResultSet, getConnection, getCurrentResultSet, getDeletedRowsCount, getFetchDirection, getFetchSize, getGeneratedKeys, getInsertedRowsCount, getLargeMaxRows, getLargeUpdateCount, getLastExecutionPlan, getLastExplainedExecutionPlan, getLocalStatementId, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getSynchronizationObject, getUpdateCount, getUpdatedRowsCount, getWarnings, hashCode, hasOpenResultSet, internalExecute, isClosed, isCloseOnCompletion, isExecuteProcedureStatement, isPoolable, isSimpleIdentifier, isValid, isWrapperFor, nativeSQL, notifyStatementCompleted, notifyStatementStarted, notifyStatementStarted, requireStatement, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, toArray, toLargeArray, unwrapMethods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.jdbc.FirebirdStatement
getCurrentResultSet, getDeletedRowsCount, getInsertedRowsCount, getLastExecutionPlan, getLastExplainedExecutionPlan, getLocalStatementId, getUpdatedRowsCount, hasOpenResultSet, isValidMethods inherited from interface java.sql.PreparedStatement
setObject, setObjectMethods inherited from interface java.sql.Statement
cancel, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeoutMethods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
METHOD_NOT_SUPPORTED
- See Also:
-
batchList
-
-
Constructor Details
-
AbstractPreparedStatement
protected AbstractPreparedStatement(GDSHelper c, int rsType, int rsConcurrency, int rsHoldability, FBObjectListener.StatementListener statementListener, FBObjectListener.BlobListener blobListener) throws SQLException Create instance of this class for the specified result set type and concurrency. This constructor is used only inFBCallableStatementsince the statement is prepared right before the execution.- Parameters:
c- instance ofGDSHelperthat will be used to perform all database activities.rsType- desired result set type.rsConcurrency- desired result set concurrency.statementListener- statement listener that will be notified about the statement start, close and completion.- Throws:
SQLException- if something went wrong.
-
AbstractPreparedStatement
protected AbstractPreparedStatement(GDSHelper c, String sql, int rsType, int rsConcurrency, int rsHoldability, FBObjectListener.StatementListener statementListener, FBObjectListener.BlobListener blobListener, boolean metaDataQuery, boolean standaloneStatement, boolean generatedKeys) throws SQLException Create instance of this class and prepare SQL statement.- Parameters:
c- connection to be used.sql- SQL statement to prepare.rsType- type of result set to create.rsConcurrency- result set concurrency.- Throws:
SQLException- if something went wrong.
-
-
Method Details
-
completeStatement
- Overrides:
completeStatementin classFBStatement- Throws:
SQLException
-
notifyStatementCompleted
- Overrides:
notifyStatementCompletedin classFBStatement- Throws:
SQLException
-
executeQuery
- Specified by:
executeQueryin interfacePreparedStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfacePreparedStatement- Throws:
SQLException
-
getFirebirdParameterMetaData
- Throws:
SQLException
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBytes
- Specified by:
setBytesin interfacePreparedStatement- Throws:
SQLException
-
setBoolean
- Specified by:
setBooleanin interfacePreparedStatement- Throws:
SQLException
-
setByte
- Specified by:
setBytein interfacePreparedStatement- Throws:
SQLException
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setDouble
- Specified by:
setDoublein interfacePreparedStatement- Throws:
SQLException
-
setFloat
- Specified by:
setFloatin interfacePreparedStatement- Throws:
SQLException
-
setInt
- Specified by:
setIntin interfacePreparedStatement- Throws:
SQLException
-
setLong
- Specified by:
setLongin interfacePreparedStatement- Throws:
SQLException
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setShort
- Specified by:
setShortin interfacePreparedStatement- Throws:
SQLException
-
setString
- Specified by:
setStringin interfacePreparedStatement- Throws:
SQLException
-
setStringForced
Sets the designated parameter to the given String value. This is a workaround for the ambiguous "operation was cancelled" response from the server for when an oversized string is set for a limited-size field. This method sets the string parameter without checking size constraints.- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- The String value to be set- Throws:
SQLException- if a database access occurs
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setBigDecimal
- Specified by:
setBigDecimalin interfacePreparedStatement- Throws:
SQLException
-
getParameterDescriptor
Returns theFieldDescriptorof the specified parameter.- Parameters:
columnIndex- 1-based index of the parameter- Returns:
- Field descriptor
-
getField
Factory method for the field access objects- Throws:
SQLException
-
setAsciiStream
Implementation note: works identical to
setBinaryStream(int, InputStream, int).- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException Implementation note: works identical to
setBinaryStream(int, InputStream, long).- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
Implementation note: works identical to
setBinaryStream(int, InputStream).- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException Deprecated.Method is no longer supported since Jaybird 3.0.For old behavior use
setBinaryStream(int, InputStream, int). For JDBC suggested behavior, usesetCharacterStream(int, Reader, int).- Specified by:
setUnicodeStreamin interfacePreparedStatement- Throws:
SQLFeatureNotSupportedException- AlwaysSQLException
-
setURL
Jaybird does not support array types.
- Specified by:
setURLin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
Implementation note: This method behaves exactly the same as
setCharacterStream(int, Reader, long).- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
Implementation note: This method behaves exactly the same as
setCharacterStream(int, Reader).- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNClob
Implementation note: This method behaves exactly the same as
setClob(int, Reader, long).- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
Implementation note: This method behaves exactly the same as
setClob(int, Reader).- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNString
Implementation note: This method behaves exactly the same as
setString(int, String).- Specified by:
setNStringin interfacePreparedStatement- Throws:
SQLException
-
clearParameters
- Specified by:
clearParametersin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException Implementation note: ignores
scaleandtargetSqlTypeand works assetObject(int, Object).- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
Implementation note: ignores
targetSqlTypeand works assetObject(int, Object).- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfacePreparedStatement- Throws:
SQLException
-
internalExecute
Execute this statement. Method checks whether all parameters are set, flushes all "flushable" fields that might contain cached data and executes the statement.- Parameters:
sendOutParams- Determines if the XSQLDA structure should be sent to the database- Returns:
trueif the statement has more result sets.- Throws:
SQLException
-
isGeneratedKeyQuery
protected boolean isGeneratedKeyQuery()- Overrides:
isGeneratedKeyQueryin classFBStatement- Returns:
truewhen the current statement is expected to return generated keys,falseotherwise.
-
addBatch
- Specified by:
addBatchin interfacePreparedStatement- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatchin interfaceStatement- Overrides:
clearBatchin classFBStatement- Throws:
SQLException
-
executeBatchInternal
- Overrides:
executeBatchInternalin classFBStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setRef
Jaybird does not support ref types.
- Specified by:
setRefin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setArray
Jaybird does not support array types.
- Specified by:
setArrayin interfacePreparedStatement- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
prepareFixedStatement
Prepare fixed statement and initialize parameters.- Overrides:
prepareFixedStatementin classFBStatement- Throws:
SQLException
-
getExecutionPlan
Description copied from interface:FirebirdPreparedStatementGet the execution plan of this PreparedStatement- Specified by:
getExecutionPlanin interfaceFirebirdPreparedStatement- Returns:
- The execution plan of the statement
- Throws:
SQLException
-
getExplainedExecutionPlan
Description copied from interface:FirebirdPreparedStatementGet the detailed execution plan of this PreparedStatement- Specified by:
getExplainedExecutionPlanin interfaceFirebirdPreparedStatement- Returns:
- The detailed execution plan of the statement
- Throws:
SQLException
-
getStatementType
Description copied from interface:FirebirdPreparedStatementGet the statement type of this PreparedStatement. The returned value will be one of theTYPE_*constant values.- Specified by:
getStatementTypein interfaceFirebirdPreparedStatement- Returns:
- The identifier for the given statement's type
- Throws:
SQLException
-
getParameterMetaData
- Specified by:
getParameterMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setNClob
Implementation note: This method behaves exactly the same as
setClob(int, Clob).- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setRowId
- Specified by:
setRowIdin interfacePreparedStatement- Throws:
SQLException
-
setSQLXML
Jaybird does not support SQLXML.
- Specified by:
setSQLXMLin interfacePreparedStatement- Throws:
SQLException
-
executeQuery
- Specified by:
executeQueryin interfaceStatement- Overrides:
executeQueryin classFBStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classFBStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Overrides:
executein classFBStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfaceStatement- Overrides:
addBatchin classFBStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classFBStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classFBStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classFBStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Overrides:
executein classFBStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Overrides:
executein classFBStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Overrides:
executein classFBStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfacePreparedStatement- Throws:
SQLException
-