- All Implemented Interfaces:
AutoCloseable,PreparedStatement,Statement,Wrapper,FirebirdPreparedStatement,FirebirdStatement
- Direct Known Subclasses:
FBCallableStatement
PreparedStatement.
This class is internal API of Jaybird. Future versions may radically change, move, or make inaccessible this type.
For the public API, refer to the PreparedStatement and FirebirdPreparedStatement interfaces.
- 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
currentStatementResult, fbStatement, gdsHelper, isSingletonResult, specialResult, statementListenerFields inherited from class org.firebirdsql.jdbc.AbstractStatement
connectionFields 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_SAVEPOINT, 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
ConstructorsModifierConstructorDescriptionprotectedFBPreparedStatement(FBConnection connection, String sql, ResultSetBehavior rsBehavior, FBObjectListener.StatementListener statementListener, @Nullable FBObjectListener.BlobListener blobListener, boolean metaDataQuery, boolean standaloneStatement, boolean generatedKeys) Create instance of this class and prepare SQL statement.protectedFBPreparedStatement(FBConnection connection, ResultSetBehavior rsBehavior, FBObjectListener.StatementListener statementListener, FBObjectListener.BlobListener blobListener) Create instance of this class for the specified result set type and concurrency. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()voidvoidvoidvoidclose()voidcompleteStatement(CompletionReason reason) Completes this statement withreason.booleanexecute()booleanbooleanbooleanbooleanlongexecuteQuery(String sql) intintexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndex) intexecuteUpdate(String sql, String[] columnNames) protected FBFieldgetField(int columnIndex) Factory method for the field access objects@Nullable ResultSetMetaDataprotected FieldDescriptorgetParameterDescriptor(int columnIndex) Returns theFieldDescriptorof the specified parameter.protected booleaninternalExecute(boolean sendOutParams) Execute this statement.protected booleanprotected voidnotifyStatementCompleted(boolean success) Notifies statement completion.protected voidPrepare fixed statement and initialize parameters.voidfinal voidsetAsciiStream(int parameterIndex, @Nullable InputStream x) final voidsetAsciiStream(int parameterIndex, @Nullable InputStream x, int length) final voidsetAsciiStream(int parameterIndex, @Nullable InputStream x, long length) voidsetBigDecimal(int parameterIndex, @Nullable BigDecimal x) voidsetBinaryStream(int parameterIndex, @Nullable InputStream inputStream) voidsetBinaryStream(int parameterIndex, @Nullable InputStream inputStream, int length) voidsetBinaryStream(int parameterIndex, @Nullable InputStream inputStream, long length) voidsetBlob(int parameterIndex, @Nullable InputStream inputStream) voidsetBlob(int parameterIndex, @Nullable InputStream inputStream, long length) voidvoidsetBoolean(int parameterIndex, boolean x) voidsetByte(int parameterIndex, byte x) voidsetBytes(int parameterIndex, byte @Nullable [] x) voidsetCharacterStream(int parameterIndex, @Nullable Reader reader) voidsetCharacterStream(int parameterIndex, @Nullable Reader reader, int length) voidsetCharacterStream(int parameterIndex, @Nullable 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, @Nullable Reader value) voidsetNCharacterStream(int parameterIndex, @Nullable Reader value, long length) voidvoidvoidvoidsetNString(int parameterIndex, @Nullable String value) voidsetNull(int parameterIndex, int sqlType) voidvoidvoidvoidvoidvoidvoidvoidvoidsetShort(int parameterIndex, short x) voidvoidvoidvoidvoidsetTimestamp(int parameterIndex, @Nullable Timestamp x) voidsetTimestamp(int parameterIndex, @Nullable Timestamp x, @Nullable Calendar cal) voidsetUnicodeStream(int parameterIndex, @Nullable InputStream x, int length) Deprecated.voidMethods inherited from class org.firebirdsql.jdbc.FBStatement
cancel, createBatchUpdateException, createBatchUpdateException, createSpecialResultSet, createStatementListener, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeBatch, executeImpl, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getCurrentResultSet, getDeletedRowsCount, getExecutionPlan, getExplainedExecutionPlan, getGeneratedKeys, getInsertedRowsCount, getLargeUpdateCount, getLargeUpdateCountMinZero, getMaxFieldSize, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSet, getStatementHandle, getStatementType, getUpdateCount, getUpdateCountMinZero, getUpdatedRowsCount, hasOpenResultSet, internalExecute, internalExecute, isSimpleIdentifier, isValid, isWrapperFor, nativeSQL, notifyStatementCompleted, notifyStatementStarted, notifyStatementStarted, setEscapeProcessing, setMaxFieldSize, setQueryTimeout, unwrapMethods inherited from class org.firebirdsql.jdbc.AbstractStatement
addWarning, checkValidity, clearWarnings, closeOnCompletion, completeStatement, equals, fetchConfig, getConnection, getCursorName, getFetchDirection, getFetchSize, getLargeMaxRows, getLocalStatementId, getMaxRows, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, hashCode, isClosed, isCloseOnCompletion, isPoolable, performCloseOnCompletion, resultSetBehavior, setCursorName, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxRows, setPoolable, withLockMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.jdbc.FirebirdPreparedStatement
getStatementTypeMethods inherited from interface org.firebirdsql.jdbc.FirebirdStatement
getCurrentResultSet, getDeletedRowsCount, getExecutionPlan, getExplainedExecutionPlan, getInsertedRowsCount, getLastExecutionPlan, getLastExplainedExecutionPlan, getLocalStatementId, getUpdatedRowsCount, hasOpenResultSet, isValidMethods inherited from interface java.sql.Statement
cancel, clearWarnings, 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:
-
-
Constructor Details
-
FBPreparedStatement
protected FBPreparedStatement(FBConnection connection, ResultSetBehavior rsBehavior, 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:
connection- connection to be usedrsBehavior- result set behaviorstatementListener- statement listener that will be notified about the statement start, close and completionblobListener- blob listener that will be notified about the statement start and completion- Throws:
SQLException- if something went wrong.
-
FBPreparedStatement
protected FBPreparedStatement(FBConnection connection, String sql, ResultSetBehavior rsBehavior, FBObjectListener.StatementListener statementListener, @Nullable FBObjectListener.BlobListener blobListener, boolean metaDataQuery, boolean standaloneStatement, boolean generatedKeys) throws SQLException Create instance of this class and prepare SQL statement.- Parameters:
connection- connection to be usedsql- SQL statement to preparersBehavior- result set behaviorstatementListener- statement listener that will be notified about the statement start, close and completionblobListener- blob listener that will be notified about the statement start and completionmetaDataQuery-truefor a metadata query,falsefor a normal querystandaloneStatement-truefor a standalone statement (should only be used whenmetaDataQuery == true)generatedKeys-trueif this statement produces a generated keys result set- Throws:
SQLException- if something went wrong.
-
-
Method Details
-
completeStatement
Description copied from class:AbstractStatementCompletes this statement withreason.On completion, any open result set will be closed, and possibly the statement itself may be closed.
- Overrides:
completeStatementin classFBStatement- Parameters:
reason- completion reason- Throws:
SQLException- for failures completing this statement
-
notifyStatementCompleted
Description copied from class:FBStatementNotifies statement completion.Use of
success = falseshould not be generally used for failing execution. The only difference betweentrueandfalseis whether completion triggers commit or rollback in auto-commit mode, and in general, even for failed execution, a commit should be triggered. The only exception is for batch execution in auto-commit, where we rollback if one statement failed (and this behaviour is specified by JDBC as implementation-specific), and ending a transaction if statement preparation failed inFBPreparedStatement.- Overrides:
notifyStatementCompletedin classFBStatement- Parameters:
success-truenotify successful completion,falsefor unsuccessful completion- Throws:
SQLException- exception from handling statement completion (e.g. commit or rollback in auto-commit)
-
executeQuery
- Specified by:
executeQueryin interfacePreparedStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfacePreparedStatement- Throws:
SQLException
-
close
Description copied from class:AbstractStatementSubclasses overriding this method are expected to call this method with
super.close()at an appropriate point to mark it closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Overrides:
closein classFBStatement- Throws:
SQLException
-
getFirebirdParameterMetaData
- Throws:
SQLException
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, @Nullable InputStream inputStream, int length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, @Nullable InputStream inputStream, long length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, @Nullable InputStream inputStream) throws SQLException - 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
-
setObject
public void setObject(int parameterIndex, @Nullable Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException Implementation note: behaves as
setObject(int, Object, int, int)called withSQLType.getVendorTypeNumber().- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, @Nullable Object x, SQLType targetSqlType) throws SQLException Implementation note: behaves as
setObject(int, Object, int)called withSQLType.getVendorTypeNumber().- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setShort
- Specified by:
setShortin interfacePreparedStatement- Throws:
SQLException
-
setString
- Specified by:
setStringin interfacePreparedStatement- Throws:
SQLException
-
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
public final void setAsciiStream(int parameterIndex, @Nullable InputStream x, int length) throws SQLException Implementation note: works identical to
setBinaryStream(int, InputStream, int).- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, @Nullable 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(since="1") public void setUnicodeStream(int parameterIndex, @Nullable 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
public void setNCharacterStream(int parameterIndex, @Nullable Reader value, long length) throws SQLException 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, @Nullable Object x, int targetSqlType, int scaleOrLength) throws SQLException Implementation note: ignores
scaleOrLengthandtargetSqlTypeand works assetObject(int, Object),scaleOrLengthis not ignored ifxis aReaderorInputStream.- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, @Nullable Object x, int targetSqlType) throws SQLException 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
public void setCharacterStream(int parameterIndex, @Nullable Reader reader, int length) throws SQLException - Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, @Nullable Reader reader, long length) throws SQLException - 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
public void setBlob(int parameterIndex, @Nullable InputStream inputStream, long length) throws SQLException - 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
public void setDate(int parameterIndex, @Nullable Date x, @Nullable Calendar cal) throws SQLException - Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setTime
public void setTime(int parameterIndex, @Nullable Time x, @Nullable Calendar cal) throws SQLException - Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, @Nullable Timestamp x, @Nullable Calendar cal) throws SQLException - 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
-
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
-