Class EmbedPreparedStatement
- java.lang.Object
-
- org.apache.derby.impl.jdbc.ConnectionChild
-
- org.apache.derby.impl.jdbc.EmbedStatement
-
- org.apache.derby.impl.jdbc.EmbedPreparedStatement
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper,EnginePreparedStatement,EngineStatement
- Direct Known Subclasses:
EmbedCallableStatement,EmbedPreparedStatement42
public class EmbedPreparedStatement extends EmbedStatement implements EnginePreparedStatement
EmbedPreparedStatement is a local JDBC statement. It supports JDBC 4.1.
-
-
Field Summary
Fields Modifier and Type Field Description private Activationactivationprivate BrokeredConnectionControlbccprivate java.lang.StringgcDuringGetMetaDataprotected PreparedStatementpreparedStatementprotected java.sql.ResultSetMetaDatarMetaDataprivate java.lang.BooleanusePreTenFiveHdrFormatTells which header format to use when writing CLOBs into the store.-
Fields inherited from class org.apache.derby.impl.jdbc.EmbedStatement
applicationStatement, batchStatements, isPoolable, lcc, MaxFieldSize, maxRows, results, resultSetConcurrency, resultSetType, SQLText, timeoutMillis, updateCount
-
Fields inherited from class org.apache.derby.impl.jdbc.ConnectionChild
factory, localConn
-
-
Constructor Summary
Constructors Constructor Description EmbedPreparedStatement(EmbedConnection conn, java.lang.String sql, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, java.lang.String[] columnNames)Constructor assumes caller will setup context stack and restore it.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddBatch()JDBC 2.0 Add a set of parameters to the batch.voidaddBatch(java.lang.String sql)JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement.private voidcheckAsciiStreamConditions(int parameterIndex)Check general preconditions for setAsciiStream methods.private voidcheckBinaryStreamConditions(int parameterIndex)Check general preconditions for setBinaryStream methods.private voidcheckBlobConditions(int parameterIndex)Check general (pre)conditions for setBlob methods.private voidcheckCharacterStreamConditions(int parameterIndex)Check general preconditions for setCharacterStream methods.private voidcheckClobConditions(int parameterIndex)Check general (pre)conditions for setClob methods.private voidcheckStatementValidity(java.sql.SQLException sqle)Method calls onStatementError occurred on the BrokeredConnectionControl class after checking the SQLState of the SQLException thrown.voidclearParameters()In general, parameter values remain in force for repeated use of a Statement.(package private) voidcloseActions()Additional close to close our activation.(package private) java.sql.SQLExceptiondataTypeConversion(int column, java.lang.String sourceType)booleanexecute()booleanexecute(java.lang.String sql)Execute a SQL statement that may return multiple results.booleanexecute(java.lang.String sql, int autoGenKeys)JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.booleanexecute(java.lang.String sql, int[] columnIndexes)JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.booleanexecute(java.lang.String sql, java.lang.String[] columnNames)JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.(package private) booleanexecuteBatchElement(java.lang.Object batchElement)Execute a single element of the batch.longexecuteLargeUpdate()Execute a SQL INSERT, UPDATE or DELETE statement.java.sql.ResultSetexecuteQuery()A prepared SQL query is executed and its ResultSet is returned.java.sql.ResultSetexecuteQuery(java.lang.String sql)Execute a SQL statement that returns a single ResultSet.(package private) booleanexecuteStatement(Activation a, boolean executeQuery, boolean executeUpdate)Execute the current statement.intexecuteUpdate()Execute a SQL INSERT, UPDATE or DELETE statement.intexecuteUpdate(java.lang.String sql)Execute a SQL INSERT, UPDATE or DELETE statement.intexecuteUpdate(java.lang.String sql, int autoGenKeys)JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.intexecuteUpdate(java.lang.String sql, int[] columnIndexes)JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.intexecuteUpdate(java.lang.String sql, java.lang.String[] columnNames)JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.protected voidfinalize()JDBC states that a Statement is closed when garbage collected.java.sql.ResultSetMetaDatagetMetaData()JDBC 2.0 The number, types and properties of a ResultSet's columns are provided by the getMetaData method.protected intgetParameterJDBCType(int parameterIndex)Get the target JDBC type for a parameter.java.sql.ParameterMetaDatagetParameterMetaData()JDBC 3.0 Retrieves the number, types and properties of this PreparedStatement object's parameters.protected java.lang.StringgetParameterSQLType(int parameterIndex)Return the SQL type name for the parameter.ParameterValueSetgetParms()Get the ParameterValueSet from the activation.longgetVersionCounter()Get the version of the prepared statement.protected EmbedResultSetMetaDatanewEmbedResultSetMetaData(ResultDescription resultDesc)voidsetArray(int i, java.sql.Array x)JDBC 2.0 Set an Array parameter.voidsetAsciiStream(int parameterIndex, java.io.InputStream x)Sets the designated parameter to the given input stream.voidsetAsciiStream(int parameterIndex, java.io.InputStream x, int length)We do this inefficiently and read it all in here.voidsetAsciiStream(int parameterIndex, java.io.InputStream x, long length)We do this inefficiently and read it all in here.voidsetBigDecimal(int parameterIndex, java.math.BigDecimal x)Set a parameter to a java.lang.BigDecimal value.voidsetBinaryStream(int parameterIndex, java.io.InputStream x)Sets the designated parameter to the given input stream.voidsetBinaryStream(int parameterIndex, java.io.InputStream x, int length)sets the parameter to the binary streamvoidsetBinaryStream(int parameterIndex, java.io.InputStream x, long length)sets the parameter to the Binary streamprivate voidsetBinaryStreamInternal(int parameterIndex, java.io.InputStream x, boolean lengthLess, long length)Set the given stream for the specified parameter.voidsetBlob(int parameterIndex, java.io.InputStream inputStream)Sets the designated parameter to aInputStreamobject.voidsetBlob(int parameterIndex, java.io.InputStream inputStream, long length)Sets the designated parameter to a InputStream object.voidsetBlob(int i, java.sql.Blob x)JDBC 2.0 Set a BLOB parameter.voidsetBoolean(int parameterIndex, boolean x)Set a parameter to a Java boolean value.voidsetBrokeredConnectionControl(BrokeredConnectionControl control)This method is used to initialize the BrokeredConnectionControl variable with its implementation.voidsetByte(int parameterIndex, byte x)Set a parameter to a Java byte value.voidsetBytes(int parameterIndex, byte[] x)Set a parameter to a Java array of bytes.voidsetCharacterStream(int parameterIndex, java.io.Reader reader)Sets the designated parameter to the givenReaderobject.voidsetCharacterStream(int parameterIndex, java.io.Reader reader, int length)When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader.voidsetCharacterStream(int parameterIndex, java.io.Reader reader, long length)When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader.private voidsetCharacterStreamInternal(int parameterIndex, java.io.Reader reader, boolean lengthLess, long length)Set the given character stream for the specified parameter.voidsetClob(int parameterIndex, java.io.Reader reader)Sets the designated parameter to aReaderobject.voidsetClob(int parameterIndex, java.io.Reader reader, long length)Sets the designated parameter to a Reader object.voidsetClob(int i, java.sql.Clob x)JDBC 2.0 Set a CLOB parameter.voidsetDate(int parameterIndex, java.sql.Date x)Set a parameter to a java.sql.Date value.voidsetDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)Set a parameter to a java.sql.Date value.voidsetDouble(int parameterIndex, double x)Set a parameter to a Java double value.voidsetFloat(int parameterIndex, float x)Set a parameter to a Java float value.voidsetInt(int parameterIndex, int x)Set a parameter to a Java int value.voidsetLong(int parameterIndex, long x)Set a parameter to a Java long value.voidsetNCharacterStream(int parameterIndex, java.io.Reader value)voidsetNCharacterStream(int index, java.io.Reader value, long length)voidsetNClob(int parameterIndex, java.io.Reader reader)voidsetNClob(int parameterIndex, java.io.Reader reader, long length)voidsetNClob(int index, java.sql.NClob value)voidsetNString(int index, java.lang.String value)voidsetNull(int parameterIndex, int sqlType)Set a parameter to SQL NULL.voidsetNull(int paramIndex, int sqlType, java.lang.String typeName)JDBC 2.0 Sets the designated parameter to SQLNULL.voidsetObject(int parameterIndex, java.lang.Object x)Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType)This method is like setObject above, but assumes a scale of zero.voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)The interface says that the type of the Object parameter must be compatible with the type of the targetSqlType.voidsetRef(int i, java.sql.Ref x)JDBC 2.0 Set a REF(<structured-type>) parameter.voidsetRowId(int parameterIndex, java.sql.RowId x)private voidsetScale(int parameterIndex, int scale)Set the scale of a parameter.voidsetShort(int parameterIndex, short x)Set a parameter to a Java short value.voidsetSQLXML(int parameterIndex, java.sql.SQLXML xmlObject)voidsetString(int parameterIndex, java.lang.String x)Set a parameter to a Java String value.voidsetTime(int parameterIndex, java.sql.Time x)Set a parameter to a java.sql.Time value.voidsetTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)Set a parameter to a java.sql.Time value.voidsetTimestamp(int parameterIndex, java.sql.Timestamp x)Set a parameter to a java.sql.Timestamp value.voidsetTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)Set a parameter to a java.sql.Timestamp value.voidsetUnicodeStream(int parameterIndex, java.io.InputStream x, int length)Deprecated.voidsetURL(int parameterIndex, java.net.URL x)JDBC 3.0 Sets the designated parameter to the given java.net.URL value.java.lang.StringtoString()voidtransferParameters(EmbedPreparedStatement newStatement)private java.lang.BooleanusePreTenFiveHdrFormat()Determines which header format to use for CLOBs when writing them to the store.-
Methods inherited from class org.apache.derby.impl.jdbc.EmbedStatement
addWarning, cancel, checkExecStatus, checkIfInMiddleOfBatch, checkRequiresCallableStatement, checkStatus, clearBatch, clearResultSets, clearWarnings, close, closeMeOnCompletion, closeOnCompletion, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getParameterValueSet, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getSQLText, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, processDynamicResult, resultSetClosing, setApplicationStatement, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, transferBatch, unwrap
-
Methods inherited from class org.apache.derby.impl.jdbc.ConnectionChild
commitIfAutoCommit, commitIfNeeded, getCal, getConnectionSynchronization, getEmbedConnection, getLanguageConnectionContext, getLCC, handleException, needCommit, newSQLException, restoreContextStack, restoreIntrFlagIfSeen, setupContextStack
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.jdbc.EngineStatement
closeOnCompletion, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isCloseOnCompletion, setLargeMaxRows
-
Methods inherited from interface java.sql.Statement
cancel, clearBatch, clearWarnings, close, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeBatch, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Field Detail
-
rMetaData
protected java.sql.ResultSetMetaData rMetaData
-
gcDuringGetMetaData
private java.lang.String gcDuringGetMetaData
-
preparedStatement
protected PreparedStatement preparedStatement
-
activation
private Activation activation
-
usePreTenFiveHdrFormat
private java.lang.Boolean usePreTenFiveHdrFormat
Tells which header format to use when writing CLOBs into the store.This is lazily set if we need it, and there are currently only two valid header formats to choose between.
- See Also:
usePreTenFiveHdrFormat()
-
bcc
private BrokeredConnectionControl bcc
-
-
Constructor Detail
-
EmbedPreparedStatement
public EmbedPreparedStatement(EmbedConnection conn, java.lang.String sql, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, java.lang.String[] columnNames) throws java.sql.SQLException
Constructor assumes caller will setup context stack and restore it.- Throws:
java.sql.SQLException
-
-
Method Detail
-
finalize
protected void finalize() throws java.lang.ThrowableJDBC states that a Statement is closed when garbage collected.- Overrides:
finalizein classEmbedStatement- Throws:
java.lang.Throwable- Allows any exception to be thrown during finalize
-
execute
public final boolean execute(java.lang.String sql) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementExecute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).- Specified by:
executein interfacejava.sql.Statement- Overrides:
executein classEmbedStatement- Parameters:
sql- any SQL statement- Returns:
- true if the first result is a ResultSet; false if it is an integer
- Throws:
java.sql.SQLException- thrown on failure- See Also:
EmbedStatement.getResultSet(),EmbedStatement.getUpdateCount(),EmbedStatement.getMoreResults()
-
execute
public final boolean execute(java.lang.String sql, int autoGenKeys) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT/UPDATE statement.- Specified by:
executein interfacejava.sql.Statement- Overrides:
executein classEmbedStatement- Parameters:
sql- any SQL statementautoGenKeys- - a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS- Returns:
- rue if the first result is a ResultSet object; false if it is an update count or there are no results
- Throws:
java.sql.SQLException- if a database access error occurs
-
execute
public final boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT/UPDATE statement.- Specified by:
executein interfacejava.sql.Statement- Overrides:
executein classEmbedStatement- Parameters:
sql- any SQL statementcolumnIndexes- - an array of the indexes of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys- Returns:
- rue if the first result is a ResultSet object; false if it is an update count or there are no results
- Throws:
java.sql.SQLException- if a database access error occurs
-
execute
public final boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT/UPDATE statement.- Specified by:
executein interfacejava.sql.Statement- Overrides:
executein classEmbedStatement- Parameters:
sql- any SQL statementcolumnNames- - an array of the names of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys- Returns:
- rue if the first result is a ResultSet object; false if it is an update count or there are no results
- Throws:
java.sql.SQLException- if a database access error occurs
-
executeQuery
public final java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementExecute a SQL statement that returns a single ResultSet.- Specified by:
executeQueryin interfacejava.sql.Statement- Overrides:
executeQueryin classEmbedStatement- Parameters:
sql- typically this is a static SQL SELECT statement- Returns:
- a ResultSet that contains the data produced by the query; never null
- Throws:
java.sql.SQLException- thrown on failure.
-
executeUpdate
public final int executeUpdate(java.lang.String sql) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementExecute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.- Specified by:
executeUpdatein interfacejava.sql.Statement- Overrides:
executeUpdatein classEmbedStatement- Parameters:
sql- a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing- Returns:
- either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- thrown on failure.
-
executeUpdate
public final int executeUpdate(java.lang.String sql, int autoGenKeys) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.- Specified by:
executeUpdatein interfacejava.sql.Statement- Overrides:
executeUpdatein classEmbedStatement- Parameters:
sql- a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothingautoGenKeys- - a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS- Returns:
- either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- if a database access error occurs
-
executeUpdate
public final int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement- Specified by:
executeUpdatein interfacejava.sql.Statement- Overrides:
executeUpdatein classEmbedStatement- Parameters:
sql- a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothingcolumnIndexes- - an array of column indexes indicating the columns that should be returned from the inserted row- Returns:
- either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- if a database access error occurs
-
executeUpdate
public final int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement- Specified by:
executeUpdatein interfacejava.sql.Statement- Overrides:
executeUpdatein classEmbedStatement- Parameters:
sql- a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothingcolumnNames- - an array of the names of the columns that should be returned from the inserted row- Returns:
- either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- if a database access error occurs
-
addBatch
public final void addBatch(java.lang.String sql) throws java.sql.SQLExceptionDescription copied from class:EmbedStatementJDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. This method is optional.- Specified by:
addBatchin interfacejava.sql.Statement- Overrides:
addBatchin classEmbedStatement- Parameters:
sql- typically this is a static SQL INSERT or UPDATE statement- Throws:
java.sql.SQLException- if a database-access error occurs, or the driver does not support batch statements
-
closeActions
void closeActions() throws java.sql.SQLExceptionAdditional close to close our activation. In the case that a XAConnection is involved in the creation of this PreparedStatement for e.g in the following caseXAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource Connection conn = xaconnection.getConnection(); PreparedStatement ps = conn.preparedStatement("values 1");In the above case the PreparedStatement will actually be a BrokeredPreparedStatement object. Hence when we call bcc.onStatementClose and pass the PreparedStatement that caused it applicationStatement will be the appropriate choice since it will contain the appropriate instance of PreparedStatement in each case- Overrides:
closeActionsin classEmbedStatement- Throws:
java.sql.SQLException- upon failure
-
executeQuery
public final java.sql.ResultSet executeQuery() throws java.sql.SQLExceptionA prepared SQL query is executed and its ResultSet is returned.- Specified by:
executeQueryin interfacejava.sql.PreparedStatement- Returns:
- a ResultSet that contains the data produced by the query; never null
- Throws:
java.sql.SQLException- thrown on failure.
-
executeUpdate
public final int executeUpdate() throws java.sql.SQLExceptionExecute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.- Specified by:
executeUpdatein interfacejava.sql.PreparedStatement- Returns:
- either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- thrown on failure.
-
executeLargeUpdate
public final long executeLargeUpdate() throws java.sql.SQLExceptionExecute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed. For use with statements which may touch more than Integer.MAX_VALUE rows.- Specified by:
executeLargeUpdatein interfaceEnginePreparedStatement- Specified by:
executeLargeUpdatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNull
public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLExceptionSet a parameter to SQL NULL.Note: You must specify the parameter's SQL type.
- Specified by:
setNullin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...sqlType- SQL type code defined by java.sql.Types- Throws:
java.sql.SQLException- thrown on failure.
-
setBoolean
public void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLExceptionSet a parameter to a Java boolean value. According to the JDBC API spec, the driver converts this to a SQL BIT value when it sends it to the database. But we don't have to do this, since the database engine supports a boolean type.- Specified by:
setBooleanin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setByte
public void setByte(int parameterIndex, byte x) throws java.sql.SQLExceptionSet a parameter to a Java byte value. The driver converts this to a SQL TINYINT value when it sends it to the database.- Specified by:
setBytein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setShort
public void setShort(int parameterIndex, short x) throws java.sql.SQLExceptionSet a parameter to a Java short value. The driver converts this to a SQL SMALLINT value when it sends it to the database.- Specified by:
setShortin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setInt
public void setInt(int parameterIndex, int x) throws java.sql.SQLExceptionSet a parameter to a Java int value. The driver converts this to a SQL INTEGER value when it sends it to the database.- Specified by:
setIntin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setLong
public void setLong(int parameterIndex, long x) throws java.sql.SQLExceptionSet a parameter to a Java long value. The driver converts this to a SQL BIGINT value when it sends it to the database.- Specified by:
setLongin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setBigDecimal
public final void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws java.sql.SQLExceptionSet a parameter to a java.lang.BigDecimal value. The driver converts this to a SQL NUMERIC value when it sends it to the database.- Specified by:
setBigDecimalin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setFloat
public void setFloat(int parameterIndex, float x) throws java.sql.SQLExceptionSet a parameter to a Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database.- Specified by:
setFloatin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setDouble
public void setDouble(int parameterIndex, double x) throws java.sql.SQLExceptionSet a parameter to a Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database.- Specified by:
setDoublein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setString
public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLExceptionSet a parameter to a Java String value. The driver converts this to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments size relative to the driver's limits on VARCHARs) when it sends it to the database.- Specified by:
setStringin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setBytes
public void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLExceptionSet a parameter to a Java array of bytes. The driver converts this to a SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARYs) when it sends it to the database.- Specified by:
setBytesin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setDate
public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLExceptionSet a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.- Specified by:
setDatein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setTime
public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLExceptionSet a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.- Specified by:
setTimein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLExceptionSet a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLExceptionWe do this inefficiently and read it all in here. The target type is assumed to be a String.- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the ASCII parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- thrown on failure.
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionWe do this inefficiently and read it all in here. The target type is assumed to be a String.- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the ASCII parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- thrown on failure.
-
setUnicodeStream
public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionDeprecated.Deprecated in JDBC 3.0- Specified by:
setUnicodeStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the UNICODE parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- thrown on failure.
-
setCharacterStream
public final void setCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLExceptionWhen a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- the java reader which contains the UNICODE datalength- the number of characters in the stream- Throws:
java.sql.SQLException- if a database-access error occurs.
-
setCharacterStream
public final void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLExceptionWhen a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- the java reader which contains the UNICODE datalength- the number of characters in the stream- Throws:
java.sql.SQLException- if a database-access error occurs.
-
checkCharacterStreamConditions
private final void checkCharacterStreamConditions(int parameterIndex) throws java.sql.SQLExceptionCheck general preconditions for setCharacterStream methods.- Parameters:
parameterIndex- 1-based index of the parameter.- Throws:
java.sql.SQLException
-
checkAsciiStreamConditions
private final void checkAsciiStreamConditions(int parameterIndex) throws java.sql.SQLExceptionCheck general preconditions for setAsciiStream methods.- Parameters:
parameterIndex- 1-based index of the parameter.- Throws:
java.sql.SQLException
-
setCharacterStreamInternal
private void setCharacterStreamInternal(int parameterIndex, java.io.Reader reader, boolean lengthLess, long length) throws java.sql.SQLExceptionSet the given character stream for the specified parameter. IflengthLessistrue, the following conditions are either not checked or verified at the execution time of the prepared statement:- If the stream length is negative.
- If the stream's actual length equals the specified length.
lengthLessvariable was added to differentiate between streams with invalid lengths and streams without known lengths.- Parameters:
parameterIndex- the 1-based index of the parameter to set.reader- the data.lengthLess- tells whether we know the length of the data or not.length- the length of the data. Ignored iflengthLessistrue.- Throws:
java.sql.SQLException
-
usePreTenFiveHdrFormat
private java.lang.Boolean usePreTenFiveHdrFormat() throws StandardExceptionDetermines which header format to use for CLOBs when writing them to the store.- Returns:
trueif the pre Derby 10.5 header format is to be used,falseif the new header format can be used (10.5 or newer)- Throws:
StandardException- if obtaining the access mode fails
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLExceptionSets the designated parameter to the given input stream. When a very large binary value is input to aLONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. The data will be read from the stream as needed until end-of-file is reached. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the binary parameter value- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closedPreparedStatement
-
setBinaryStream
public final void setBinaryStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLExceptionsets the parameter to the Binary stream- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the binary parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- thrown on failure.
-
setBinaryStream
public final void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionsets the parameter to the binary stream- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the binary parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- thrown on failure.
-
setBinaryStreamInternal
private void setBinaryStreamInternal(int parameterIndex, java.io.InputStream x, boolean lengthLess, long length) throws java.sql.SQLExceptionSet the given stream for the specified parameter. IflengthLessistrue, the following conditions are either not checked or verified at the execution time of the prepared statement:- If the stream length is negative.
- If the stream's actual length equals the specified length.
lengthLessvariable was added to differentiate between streams with invalid lengths and streams without known lengths.- Parameters:
parameterIndex- the 1-based index of the parameter to set.x- the data.lengthLess- tells whether we know the length of the data or not.length- the length of the data. Ignored iflengthLessistrue.- Throws:
java.sql.SQLException
-
checkBinaryStreamConditions
private final void checkBinaryStreamConditions(int parameterIndex) throws java.sql.SQLExceptionCheck general preconditions for setBinaryStream methods.- Parameters:
parameterIndex- 1-based index of the parameter.- Throws:
java.sql.SQLException
-
setNull
public void setNull(int paramIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLExceptionJDBC 2.0 Sets the designated parameter to SQLNULL. This version of the methodsetNullshould be used for user-defined types and REF type parameters. Examples of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.- Specified by:
setNullin interfacejava.sql.PreparedStatement- Parameters:
paramIndex- the first parameter is 1, the second is 2, ...sqlType- a value fromjava.sql.TypestypeName- the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or REF- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closedPreparedStatementjava.sql.SQLFeatureNotSupportedException- if Derby does not support the type specified in thesqlTypeparameter
-
addBatch
public void addBatch() throws java.sql.SQLExceptionJDBC 2.0 Add a set of parameters to the batch.- Specified by:
addBatchin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- if a database-access error occurs.
-
executeBatchElement
boolean executeBatchElement(java.lang.Object batchElement) throws java.sql.SQLException, StandardExceptionDescription copied from class:EmbedStatementExecute a single element of the batch. Overridden by EmbedPreparedStatement- Overrides:
executeBatchElementin classEmbedStatement- Throws:
java.sql.SQLExceptionStandardException
-
clearParameters
public void clearParameters() throws java.sql.SQLExceptionIn general, parameter values remain in force for repeated use of a Statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters.
- Specified by:
clearParametersin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- thrown on failure.
-
getMetaData
public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLExceptionJDBC 2.0 The number, types and properties of a ResultSet's columns are provided by the getMetaData method.- Specified by:
getMetaDatain interfacejava.sql.PreparedStatement- Returns:
- the description of a ResultSet's columns
- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setRef
public final void setRef(int i, java.sql.Ref x) throws java.sql.SQLExceptionJDBC 2.0 Set a REF(<structured-type>) parameter.- Specified by:
setRefin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing data of an SQL REF Type- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setArray
public final void setArray(int i, java.sql.Array x) throws java.sql.SQLExceptionJDBC 2.0 Set an Array parameter.- Specified by:
setArrayin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing an SQL array- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale) throws java.sql.SQLExceptionThe interface says that the type of the Object parameter must be compatible with the type of the targetSqlType. We check that, and if it flies, we expect the underlying engine to do the required conversion once we pass in the value using its type. So, an Integer converting to a CHAR is done via setInteger() support on the underlying CHAR type.If x is null, it won't tell us its type, so we pass it on to setNull
- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- The first parameter is 1, the second is 2, ...x- The object containing the input parameter valuetargetSqlType- The SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.scale- For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored,- Throws:
java.sql.SQLException- thrown on failure.
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType) throws java.sql.SQLExceptionThis method is like setObject above, but assumes a scale of zero.- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- thrown on failure.
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x) throws java.sql.SQLExceptionSet the value of a parameter using an object; use the java.lang equivalent objects for integral values.
The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type.
- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- The first parameter is 1, the second is 2, ...x- The object containing the input parameter value- Throws:
java.sql.SQLException- thrown on failure.
-
execute
public final boolean execute() throws java.sql.SQLException- Specified by:
executein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- thrown on failure.- See Also:
Statement.execute(java.lang.String)
-
setDate
public final void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLExceptionSet a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.- Specified by:
setDatein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setTime
public final void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLExceptionSet a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.- Specified by:
setTimein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setTimestamp
public final void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLExceptionSet a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- Feature not implemented for now.
-
setBlob
public void setBlob(int i, java.sql.Blob x) throws java.sql.SQLExceptionJDBC 2.0 Set a BLOB parameter.- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing a BLOB- Throws:
java.sql.SQLException
-
checkClobConditions
private final void checkClobConditions(int parameterIndex) throws java.sql.SQLExceptionCheck general (pre)conditions for setClob methods.- Parameters:
parameterIndex- 1-based index of the parameter.- Throws:
java.sql.SQLException
-
setClob
public void setClob(int i, java.sql.Clob x) throws java.sql.SQLExceptionJDBC 2.0 Set a CLOB parameter.- Specified by:
setClobin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing a CLOB- Throws:
java.sql.SQLException
-
getParms
public final ParameterValueSet getParms()
Get the ParameterValueSet from the activation. The caller of this method should be aware that the activation associated with a Statement can change and hence the ParameterValueSet returned by this call should not be hold onto. An example of this can be seen in EmbedCallableStatement.executeStatement where at the beginning of the method, we check the validity of the parameters. But we donot keep the parameters in a local variable to use later. The reason for this is that the next call in the method, super.executeStatement can recompile the statement and create a new activation if the statement plan has been invalidated. To account for this possibility, EmbedCallableStatement.executeStatement makes another call to get the ParameterValueSet before stuffing the output parameter value into the ParameterValueSet object.- Returns:
- The ParameterValueSet for the activation
-
getParameterJDBCType
protected int getParameterJDBCType(int parameterIndex) throws java.sql.SQLExceptionGet the target JDBC type for a parameter. Will throw exceptions if the parameter index is out of range. The parameterIndex is 1-based.- Throws:
java.sql.SQLException- parameter is out of range
-
getParameterSQLType
protected final java.lang.String getParameterSQLType(int parameterIndex) throws java.sql.SQLExceptionReturn the SQL type name for the parameter.- Parameters:
parameterIndex- the 1-based index of the parameter- Returns:
- SQL name of the parameter
- Throws:
java.sql.SQLException- if parameter is out of range
-
setScale
private void setScale(int parameterIndex, int scale) throws java.sql.SQLExceptionSet the scale of a parameter.- Parameters:
parameterIndex- The first parameter is 1, the second is 2, ...scale- The scale- Throws:
java.sql.SQLException- thrown on failure.
-
setURL
public final void setURL(int parameterIndex, java.net.URL x) throws java.sql.SQLExceptionJDBC 3.0 Sets the designated parameter to the given java.net.URL value. The driver converts this to an SQL DATALINK value when it sends it to the database.- Specified by:
setURLin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- - the first parameter is 1, the second is 2, ...x- - the java.net.URL object to be set- Throws:
java.sql.SQLException- Feature not implemented for now.
-
getParameterMetaData
public final java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLExceptionJDBC 3.0 Retrieves the number, types and properties of this PreparedStatement object's parameters.- Specified by:
getParameterMetaDatain interfacejava.sql.PreparedStatement- Returns:
- a ParameterMetaData object that contains information about the number, types and properties of this PreparedStatement object's parameters.
- Throws:
java.sql.SQLException- if a database access error occurs
-
newEmbedResultSetMetaData
protected EmbedResultSetMetaData newEmbedResultSetMetaData(ResultDescription resultDesc)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
transferParameters
public void transferParameters(EmbedPreparedStatement newStatement) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
executeStatement
boolean executeStatement(Activation a, boolean executeQuery, boolean executeUpdate) throws java.sql.SQLException
Description copied from class:EmbedStatementExecute the current statement.- Overrides:
executeStatementin classEmbedStatement- Throws:
java.sql.SQLException- thrown on failure.
-
dataTypeConversion
final java.sql.SQLException dataTypeConversion(int column, java.lang.String sourceType) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setBrokeredConnectionControl
public void setBrokeredConnectionControl(BrokeredConnectionControl control)
This method is used to initialize the BrokeredConnectionControl variable with its implementation. This method will be called in the BrokeredConnectionControl class- Parameters:
control- used to call the onStatementClose and onStatementErrorOccurred methods that have logic to raise StatementEvents for the close and error events on the PreparedStatement
-
checkStatementValidity
private void checkStatementValidity(java.sql.SQLException sqle) throws java.sql.SQLExceptionMethod calls onStatementError occurred on the BrokeredConnectionControl class after checking the SQLState of the SQLException thrown. In the case that a XAConnection is involved in the creation of this PreparedStatement for e.g in the following caseXAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource Connection conn = xaconnection.getConnection(); PreparedStatement ps = conn.preparedStatement("values 1");In the above case the PreparedStatement will actually be a BrokeredPreparedStatement object. Hence when we call bcc.onStatementClose and pass the PreparedStatement that caused it applicationStatement will be the appropriate choice since it will contain the appropriate instance of PreparedStatement in each case- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLExceptionSets the designated parameter to the given input stream. When a very large ASCII value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.InputStream. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the Java input stream that contains the ASCII parameter value- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closedPreparedStatement
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLExceptionSets the designated parameter to the givenReaderobject. When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via ajava.io.Readerobject. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. Using this lengthless overload is not less effective than using one where the stream length is specified, but since there is no length specified, the exact length check will not be performed.- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- thejava.io.Readerobject that contains the Unicode data- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closedPreparedStatement
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLExceptionSets the designated parameter to aReaderobject. This method differs from thesetCharacterStream(int,Reader)method because it informs the driver that the parameter value should be sent to the server as aCLOB. When thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHARor aCLOB.- Specified by:
setClobin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- index of the first parameter is 1, the second is 2, ...reader- an object that contains the data to set the parameter value to.- Throws:
java.sql.SQLException- if a database access error occurs, this method is called on a closed PreparedStatementor if parameterIndex does not correspond to a parameter marker in the SQL statement
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLExceptionSets the designated parameter to a Reader object.- Specified by:
setClobin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- index of the first parameter is 1, the second is 2, ...reader- An object that contains the data to set the parameter value to.length- the number of characters in the parameter data.- Throws:
java.sql.SQLException- if parameterIndex does not correspond to a parameter marker in the SQL statement, or if the length specified is less than zero.
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream) throws java.sql.SQLExceptionSets the designated parameter to aInputStreamobject. This method differs from thesetBinaryStream(int, InputStream)method because it informs the driver that the parameter value should be sent to the server as aBLOB. When thesetBinaryStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARYor aBLOB- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- index of the first parameter is 1, the second is 2, ...inputStream- an object that contains the data to set the parameter value to.- Throws:
java.sql.SQLException- if a database access error occurs, this method is called on a closedPreparedStatementor ifparameterIndexdoes not correspond to a parameter marker in the SQL statement
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream, long length) throws java.sql.SQLExceptionSets the designated parameter to a InputStream object.- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- index of the first parameter is 1, the second is 2, ...inputStream- An object that contains the data to set the parameter value to.length- the number of bytes in the parameter data.- Throws:
java.sql.SQLException- if parameterIndex does not correspond to a parameter marker in the SQL statement, if the length specified is less than zero or if the number of bytes in the inputstream does not match the specfied length.
-
checkBlobConditions
private final void checkBlobConditions(int parameterIndex) throws java.sql.SQLExceptionCheck general (pre)conditions for setBlob methods.- Parameters:
parameterIndex- 1-based index of the parameter.- Throws:
java.sql.SQLException
-
setRowId
public final void setRowId(int parameterIndex, java.sql.RowId x) throws java.sql.SQLException- Specified by:
setRowIdin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNString
public final void setNString(int index, java.lang.String value) throws java.sql.SQLException- Specified by:
setNStringin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public final void setNCharacterStream(int parameterIndex, java.io.Reader value) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public final void setNCharacterStream(int index, java.io.Reader value, long length) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public final void setNClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public final void setNClob(int index, java.sql.NClob value) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public final void setNClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setSQLXML
public final void setSQLXML(int parameterIndex, java.sql.SQLXML xmlObject) throws java.sql.SQLException- Specified by:
setSQLXMLin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
getVersionCounter
public final long getVersionCounter() throws java.sql.SQLExceptionDescription copied from interface:EnginePreparedStatementGet the version of the prepared statement. If this has not been changed, the caller may assume that a recompilation has not taken place, i.e. meta-data are (also) unchanged.- Specified by:
getVersionCounterin interfaceEnginePreparedStatement- Returns:
- version counter
- Throws:
java.sql.SQLException
-
-