org.apache.derby.client.am
Class PreparedStatement

java.lang.Object
  extended by org.apache.derby.client.am.Statement
      extended by org.apache.derby.client.am.PreparedStatement
All Implemented Interfaces:
java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper, PreparedStatementCallbackInterface, StatementCallbackInterface, UnitOfWorkListener
Direct Known Subclasses:
CallableStatement, PreparedStatement40

public class PreparedStatement
extends Statement
implements java.sql.PreparedStatement, PreparedStatementCallbackInterface


Nested Class Summary
private static class PreparedStatement.PossibleTypes
          PossibleTypes is information which is set of types.
 
Field Summary
(package private)  boolean listenToUnitOfWork_
           
 MaterialPreparedStatement materialPreparedStatement_
           
 boolean outputRegistered_
           
 ColumnMetaData parameterMetaData_
           
(package private)  boolean[] parameterRegistered_
           
 java.lang.Object[] parameters_
           
(package private)  boolean[] parameterSet_
           
private  java.util.ArrayList parameterTypeList
           
protected  ClientPooledConnection pooledConnection_
           
(package private)  java.lang.String positionedUpdateCursorName_
           
 java.lang.String sql_
           
 
Fields inherited from class org.apache.derby.client.am.Statement
agent_, autoGeneratedKeys_, batch_, cachedCursor_, cachedSingletonRowData_, CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, connection_, cursorAttributesToSendOnPrepare_, cursorName_, doWriteTimeout, executeMethod__, executeQueryMethod__, executeUpdateMethod__, fetchDirection_, fetchSize_, generatedKeysColumnIndexes_, generatedKeysColumnNames_, generatedKeysResultSet_, indexOfCurrentResultSet_, isAutoCommittableStatement_, isCall__, isCatalogQuery_, isCommitSql__, isDeleteSql__, isInsertSql__, isPoolable, isPositionedUpdateDeleteSql__, isPreparedStatement_, isQuery__, isRollbackSql__, isUpdate__, isUpdateSql__, KEEP_CURRENT_RESULT, materialStatement_, maxFieldSize_, maxRows_, numInvisibleRS_, openOnClient_, openOnServer_, preparedStatementForAutoGeneratedKeys_, resultSet_, resultSetConcurrency_, resultSetHoldability_, resultSetList_, resultSetMetaData_, resultSetType_, returnValueFromProcedure_, section_, singletonRowData_, sqlMode_, sqlUpdateMode_, timeout_, TIMEOUT_STATEMENT, timeoutArrayList, updateCount_
 
Fields 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
PreparedStatement(Agent agent, Connection connection, java.lang.String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, java.lang.String[] columnNames, int[] columnIndexes, ClientPooledConnection cpc)
          The PreparedStatementConstructor used for jdbc 2 prepared statements with scroll attributes.
PreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section, ClientPooledConnection cpc)
          The PreparedStatement constructor used for JDBC 2 positioned update statements.
 
Method Summary
 void addBatch()
           
private  void checkForSupportedDataType(int dataType)
          Checks whether a data type is supported for setObject(int, Object, int) and setObject(int, Object, int, int).
(package private)  void checkForValidParameterIndex(int parameterIndex)
           
(package private)  void checkForValidScale(int scale)
           
(package private)  void checkScaleForINOUTDecimal(int parameterIndex, int registerOutScale)
           
private  void checkStatementValidity(SqlException sqle)
           
private  void checkStreamLength(long length)
          Check the length passed in for the stream that is to be set.
private  void checkThatAllParametersAreSet()
           
private  void checkTypeForSetAsciiStream(int parameterIndex)
           
private  void checkTypeForSetBinaryStream(int parameterIndex)
           
private  void checkTypeForSetBlob(int parameterIndex)
           
private  void checkTypeForSetCharacterStream(int parameterIndex)
           
private  void checkTypeForSetClob(int parameterIndex)
           
 void clearParameters()
           
 void completeDescribeInput(ColumnMetaData parameterMetaData, Sqlca sqlca)
           
 void completeDescribeOutput(ColumnMetaData resultSetMetaData, Sqlca sqlca)
           
 void completeLocalCommit(java.util.Iterator listenerIterator)
           
 void completeLocalRollback(java.util.Iterator listenerIterator)
           
(package private)  void completePrepareDescribe()
           
 boolean execute()
           
 boolean execute(java.lang.String sql)
           
 boolean execute(java.lang.String sql, int autoGeneratedKeys)
           
 boolean execute(java.lang.String sql, int[] columnIndexes)
           
 boolean execute(java.lang.String sql, java.lang.String[] columnNames)
           
 int[] executeBatch()
           
private  int[] executeBatchRequestX(boolean supportsQueryBatchRequest)
           
 int[] executeBatchX(boolean supportsQueryBatchRequest)
           
 java.sql.ResultSet executeQuery()
           
 java.sql.ResultSet executeQuery(java.lang.String sql)
           
(package private)  ResultSet executeQueryX()
           
 int executeUpdate()
           
 int executeUpdate(java.lang.String sql)
           
 int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
           
 int executeUpdate(java.lang.String sql, int[] columnIndexes)
           
 int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
           
private  int executeUpdateX()
           
(package private)  boolean executeX()
           
private  boolean[] expandBooleanArray(boolean[] array, int newLength)
           
private  java.lang.Object[] expandObjectArray(java.lang.Object[] array, int newLength)
           
private  void flowExecute(int executeType)
           
(package private)  void flowPrepareDescribeInputOutput()
           
private  ColumnMetaData getColumnMetaDataX()
           
protected  java.lang.String getJdbcStatementInterfaceName()
          Returns the name of the java.sql interface implemented by this class.
 java.sql.ResultSetMetaData getMetaData()
           
private  ColumnMetaData getMetaDataX()
           
 java.sql.ParameterMetaData getParameterMetaData()
           
private  ParameterMetaData getParameterMetaDataX()
           
private  void initPreparedStatement()
           
private  void initPreparedStatement(ColumnMetaData parameterMetaData, ColumnMetaData resultSetMetaData)
           
private  void initPreparedStatement(java.lang.String sql)
           
private  void initPreparedStatement(java.lang.String sql, Section section)
           
protected  void initResetPreparedStatement()
           
 void listenToUnitOfWork()
           
protected  void markClosed(boolean removeListener)
          This method cleans up client-side resources held by this Statement.
(package private)  void prepare()
           
 void readDescribeInput()
           
 void readDescribeOutput()
           
 void readExecute()
           
(package private)  void readPrepareDescribeInput()
           
(package private)  void readPrepareDescribeInputOutput()
           
 void reset(boolean fullReset)
           
(package private)  void resetForReuse()
          Resets the prepared statement for reuse in a statement pool.
private  void resetParameters()
           
 void resetPreparedStatement(Agent agent, Connection connection, java.lang.String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, java.lang.String[] columnNames, int[] columnIndexes)
           
 void resetPreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section)
           
 void resetPreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section, ColumnMetaData parameterMetaData, ColumnMetaData resultSetMetaData)
           
 void setArray(int parameterIndex, java.sql.Array x)
           
 void setAsciiStream(int parameterIndex, java.io.InputStream x)
          Sets the designated parameter to the given input stream.
 void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
          We do this inefficiently and read it all in here.
 void setAsciiStream(int parameterIndex, java.io.InputStream x, long length)
          We do this inefficiently and read it all in here.
 void setBigDecimal(int parameterIndex, java.math.BigDecimal x)
           
 void setBinaryStream(int parameterIndex, java.io.InputStream x)
          Sets the designated parameter to the given input stream.
 void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
          sets the parameter to the Binary Stream object
 void setBinaryStream(int parameterIndex, java.io.InputStream x, long length)
          sets the parameter to the Binary Stream object
protected  void setBinaryStreamX(int parameterIndex, java.io.InputStream x, int length)
           
 void setBlob(int parameterIndex, java.sql.Blob x)
           
 void setBlob(int parameterIndex, java.io.InputStream inputStream)
          Sets the designated parameter to a InputStream object.
 void setBlob(int parameterIndex, java.io.InputStream inputStream, long length)
          Sets the designated parameter to a InputStream object.
 void setBlobX(int parameterIndex, java.sql.Blob x)
           
 void setBoolean(int parameterIndex, boolean x)
           
 void setByte(int parameterIndex, byte x)
           
 void setBytes(int parameterIndex, byte[] x)
           
 void setBytesX(int parameterIndex, byte[] x)
           
 void setCharacterStream(int parameterIndex, java.io.Reader x)
          Sets the designated parameter to the given Reader object.
 void setCharacterStream(int parameterIndex, java.io.Reader x, int length)
          Sets the designated parameter to the given Reader, which will have the specified number of bytes.
 void setCharacterStream(int parameterIndex, java.io.Reader x, long length)
          Sets the designated parameter to the given Reader, which will have the specified number of bytes.
 void setClob(int parameterIndex, java.sql.Clob x)
           
 void setClob(int parameterIndex, java.io.Reader reader)
          Sets the designated parameter to a Reader object.
 void setClob(int parameterIndex, java.io.Reader reader, long length)
          Sets the designated parameter to a Reader object.
(package private)  void setClobX(int parameterIndex, java.sql.Clob x)
           
 void setDate(int parameterIndex, java.sql.Date x)
           
 void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar calendar)
           
 void setDouble(int parameterIndex, double x)
           
 void setFloat(int parameterIndex, float x)
           
(package private)  void setInput(int parameterIndex, java.lang.Object input)
           
 void setInt(int parameterIndex, int x)
           
(package private)  void setIntX(int parameterIndex, int x)
           
 void setLong(int parameterIndex, long x)
           
(package private)  void setLongX(int parameterIndex, long x)
           
 void setNull(int parameterIndex, int jdbcType)
           
 void setNull(int parameterIndex, int jdbcType, java.lang.String typeName)
           
(package private)  void setNullX(int parameterIndex, int jdbcType)
           
 void setObject(int parameterIndex, java.lang.Object x)
           
 void setObject(int parameterIndex, java.lang.Object x, int targetJdbcType)
           
 void setObject(int parameterIndex, java.lang.Object x, int targetJdbcType, int scale)
           
private  void setObjectX(int parameterIndex, java.lang.Object x, int targetJdbcType, int scale)
           
 void setRef(int parameterIndex, java.sql.Ref x)
           
 void setShort(int parameterIndex, short x)
           
(package private)  void setShortX(int parameterIndex, short x)
           
 void setString(int parameterIndex, java.lang.String x)
           
(package private)  void setStringX(int parameterIndex, java.lang.String x)
           
 void setTime(int parameterIndex, java.sql.Time x)
           
 void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar calendar)
           
 void setTimestamp(int parameterIndex, java.sql.Timestamp x)
           
 void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar calendar)
           
private  void setUDTX(int parameterIndex, java.lang.Object x)
          Set a UDT parameter to an object value.
 void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)
          Deprecated.  
 void setURL(int parameterIndex, java.net.URL x)
           
 void writeDescribeInput(Section section)
           
 void writeDescribeOutput(Section section)
           
 void writeExecute(Section section, ColumnMetaData parameterMetaData, java.lang.Object[] inputs, int numInputColumns, boolean outputExpected, boolean chainedWritesFollowingSetLob)
           
private  void writeOpenQuery(Section section, int fetchSize, int resultSetType, int numInputColumns, ColumnMetaData parameterMetaData, java.lang.Object[] inputs)
           
(package private)  void writePrepareDescribeInput()
           
(package private)  void writePrepareDescribeInputOutput()
           
(package private)  void writePrepareDescribeInputOutput(java.lang.String sql, Section section)
           
 
Methods inherited from class org.apache.derby.client.am.Statement
accumulateWarning, addBatch, cacheCursorAttributesToSendOnPrepare, cancel, checkAutoGeneratedKeysParameters, checkForAppropriateSqlMode, checkForClosedStatement, checkForDuplicateCursorName, checkForInvalidBatchedSql, checkForStoredProcResultSetCount, clearBatch, clearWarnings, clearWarningsX, close, closeX, completeExecute, completeExecuteCall, completeExecuteCall, completeExecuteCallOpenQuery, completeExecuteImmediate, completeExecuteSetStatement, completeOpenQuery, completePrepare, completePrepareDescribeOutput, completeSqlca, escape, executeX, extractCursorNameFromWhereCurrentOf, finalize, flowExecuteBatch, getConnection, getConnectionCallbackInterface, getFetchDirection, getFetchSize, getGeneratedKeys, getGuessedResultSetMetaData, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getOwner, getPreparedStatementForAutoGeneratedKeys, getProcedureName, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getSqlWarnings, getUpdateCount, getWarnings, isClosed, isPoolable, isQueryMode, isWrapperFor, jdbc3FeatureNotSupported, jdbc3FeatureNotSupported, mapCursorNameToResultSet, markAutoCommitted, markClosed, markClosedOnServer, markPreparedStatementForAutoGeneratedKeysClosed, markResultSetsClosed, markResultSetsClosed, parseSqlAndSetSqlModes, parseStorProcReturnedScrollableRowset, prepareAutoGeneratedKeysStatement, readClose, readCloseResultSets, readCloseResultSets, readExecuteCall, readExecuteImmediate, readExecuteImmediateForBatch, readOpenQuery, readPrepare, readPrepareAutoGeneratedKeysStatement, readPrepareDescribeOutput, readSetSpecialRegister, removeClientCursorNameFromCache, resetCursorNameAndRemoveFromWhereCurrentOfMappings, resetStatement, resetStatement, resultSetCommitting, resultSetCommitting, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setOwner, setPoolable, setQueryTimeout, setupCursorNameCacheAndMappings, setUpdateCount, substituteClientCursorNameWithServerCursorName, upperCaseProcedureName, writeClose, writeCloseResultSets, writeCloseResultSets, writeExecuteCall, writeExecuteImmediate, writeOpenQuery, writePrepare, writePrepareDescribeOutput, writeSetSpecialRegister
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.PreparedStatement
setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setRowId, setSQLXML
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 
Methods inherited from interface org.apache.derby.client.am.StatementCallbackInterface
accumulateWarning, completeExecute, completeExecuteCall, completeExecuteCall, completeExecuteCallOpenQuery, completeExecuteImmediate, completeExecuteSetStatement, completeOpenQuery, completePrepare, completePrepareDescribeOutput, completeSqlca, getConnectionCallbackInterface, getGuessedResultSetMetaData
 

Field Detail

materialPreparedStatement_

public MaterialPreparedStatement materialPreparedStatement_

sql_

public java.lang.String sql_

outputRegistered_

public boolean outputRegistered_

parameters_

public java.lang.Object[] parameters_

parameterSet_

boolean[] parameterSet_

parameterRegistered_

boolean[] parameterRegistered_

parameterMetaData_

public ColumnMetaData parameterMetaData_

parameterTypeList

private java.util.ArrayList parameterTypeList

positionedUpdateCursorName_

java.lang.String positionedUpdateCursorName_

pooledConnection_

protected final ClientPooledConnection pooledConnection_

listenToUnitOfWork_

boolean listenToUnitOfWork_
Constructor Detail

PreparedStatement

public PreparedStatement(Agent agent,
                         Connection connection,
                         java.lang.String sql,
                         Section section,
                         ClientPooledConnection cpc)
                  throws SqlException
The PreparedStatement constructor used for JDBC 2 positioned update statements. Called by material statement constructors. It has the ClientPooledConnection as one of its parameters this is used to raise the Statement Events when the prepared statement is closed

Parameters:
agent - The instance of NetAgent associated with this CallableStatement object.
connection - The connection object associated with this PreparedStatement Object.
sql - A String object that is the SQL statement to be sent to the database.
section - Section
cpc - The ClientPooledConnection wraps the underlying physical connection associated with this prepared statement. It is used to pass the Statement closed and the Statement error occurred events that occur back to the ClientPooledConnection.
Throws:
SqlException

PreparedStatement

public PreparedStatement(Agent agent,
                         Connection connection,
                         java.lang.String sql,
                         int type,
                         int concurrency,
                         int holdability,
                         int autoGeneratedKeys,
                         java.lang.String[] columnNames,
                         int[] columnIndexes,
                         ClientPooledConnection cpc)
                  throws SqlException
The PreparedStatementConstructor used for jdbc 2 prepared statements with scroll attributes. Called by material statement constructors. It has the ClientPooledConnection as one of its parameters this is used to raise the Statement Events when the prepared statement is closed

Parameters:
agent - The instance of NetAgent associated with this CallableStatement object.
connection - The connection object associated with this PreparedStatement Object.
sql - A String object that is the SQL statement to be sent to the database.
type - One of the ResultSet type constants.
concurrency - One of the ResultSet concurrency constants.
holdability - One of the ResultSet holdability constants.
autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned.
columnNames - an array of column names indicating the columns that should be returned from the inserted row or rows.
columnIndexes - an array of column names indicating the columns that should be returned from the inserted row.
cpc - The ClientPooledConnection wraps the underlying physical connection associated with this prepared statement it is used to pass the Statement closed and the Statement error occurred events that occur back to the ClientPooledConnection.
Throws:
SqlException
Method Detail

setInput

void setInput(int parameterIndex,
              java.lang.Object input)

initPreparedStatement

private void initPreparedStatement()

initResetPreparedStatement

protected void initResetPreparedStatement()
Overrides:
initResetPreparedStatement in class Statement

reset

public void reset(boolean fullReset)
           throws SqlException
Overrides:
reset in class Statement
Throws:
SqlException

resetForReuse

void resetForReuse()
             throws SqlException
Resets the prepared statement for reuse in a statement pool.

Overrides:
resetForReuse in class Statement
Throws:
SqlException - if the reset fails
See Also:
Statement.resetForReuse()

resetParameters

private void resetParameters()

resetPreparedStatement

public void resetPreparedStatement(Agent agent,
                                   Connection connection,
                                   java.lang.String sql,
                                   Section section)
                            throws SqlException
Throws:
SqlException

initPreparedStatement

private void initPreparedStatement(java.lang.String sql,
                                   Section section)
                            throws SqlException
Throws:
SqlException

resetPreparedStatement

public void resetPreparedStatement(Agent agent,
                                   Connection connection,
                                   java.lang.String sql,
                                   int type,
                                   int concurrency,
                                   int holdability,
                                   int autoGeneratedKeys,
                                   java.lang.String[] columnNames,
                                   int[] columnIndexes)
                            throws SqlException
Throws:
SqlException

initPreparedStatement

private void initPreparedStatement(java.lang.String sql)
                            throws SqlException
Throws:
SqlException

resetPreparedStatement

public void resetPreparedStatement(Agent agent,
                                   Connection connection,
                                   java.lang.String sql,
                                   Section section,
                                   ColumnMetaData parameterMetaData,
                                   ColumnMetaData resultSetMetaData)
                            throws SqlException
Throws:
SqlException

initPreparedStatement

private void initPreparedStatement(ColumnMetaData parameterMetaData,
                                   ColumnMetaData resultSetMetaData)
                            throws SqlException
Throws:
SqlException

prepare

void prepare()
       throws SqlException
Throws:
SqlException

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Overrides:
execute in class Statement
Throws:
java.sql.SQLException

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
Specified by:
executeQuery in interface java.sql.Statement
Overrides:
executeQuery in class Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Overrides:
executeUpdate in class Statement
Throws:
java.sql.SQLException

executeQuery

public java.sql.ResultSet executeQuery()
                                throws java.sql.SQLException
Specified by:
executeQuery in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

executeQueryX

ResultSet executeQueryX()
                  throws SqlException
Throws:
SqlException

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

executeUpdateX

private int executeUpdateX()
                    throws SqlException
Throws:
SqlException

setNull

public void setNull(int parameterIndex,
                    int jdbcType)
             throws java.sql.SQLException
Specified by:
setNull in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setNullX

void setNullX(int parameterIndex,
              int jdbcType)
        throws SqlException
Throws:
SqlException

setNull

public void setNull(int parameterIndex,
                    int jdbcType,
                    java.lang.String typeName)
             throws java.sql.SQLException
Specified by:
setNull in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setBoolean

public void setBoolean(int parameterIndex,
                       boolean x)
                throws java.sql.SQLException
Specified by:
setBoolean in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setByte

public void setByte(int parameterIndex,
                    byte x)
             throws java.sql.SQLException
Specified by:
setByte in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setShort

public void setShort(int parameterIndex,
                     short x)
              throws java.sql.SQLException
Specified by:
setShort in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setShortX

void setShortX(int parameterIndex,
               short x)
         throws SqlException
Throws:
SqlException

setInt

public void setInt(int parameterIndex,
                   int x)
            throws java.sql.SQLException
Specified by:
setInt in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setIntX

void setIntX(int parameterIndex,
             int x)
       throws SqlException
Throws:
SqlException

setLong

public void setLong(int parameterIndex,
                    long x)
             throws java.sql.SQLException
Specified by:
setLong in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setLongX

void setLongX(int parameterIndex,
              long x)

setFloat

public void setFloat(int parameterIndex,
                     float x)
              throws java.sql.SQLException
Specified by:
setFloat in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setDouble

public void setDouble(int parameterIndex,
                      double x)
               throws java.sql.SQLException
Specified by:
setDouble in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setBigDecimal

public void setBigDecimal(int parameterIndex,
                          java.math.BigDecimal x)
                   throws java.sql.SQLException
Specified by:
setBigDecimal in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setDate

public void setDate(int parameterIndex,
                    java.sql.Date x,
                    java.util.Calendar calendar)
             throws java.sql.SQLException
Specified by:
setDate in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setDate

public void setDate(int parameterIndex,
                    java.sql.Date x)
             throws java.sql.SQLException
Specified by:
setDate in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setTime

public void setTime(int parameterIndex,
                    java.sql.Time x,
                    java.util.Calendar calendar)
             throws java.sql.SQLException
Specified by:
setTime in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setTime

public void setTime(int parameterIndex,
                    java.sql.Time x)
             throws java.sql.SQLException
Specified by:
setTime in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setTimestamp

public void setTimestamp(int parameterIndex,
                         java.sql.Timestamp x,
                         java.util.Calendar calendar)
                  throws java.sql.SQLException
Specified by:
setTimestamp in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setTimestamp

public void setTimestamp(int parameterIndex,
                         java.sql.Timestamp x)
                  throws java.sql.SQLException
Specified by:
setTimestamp in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setString

public void setString(int parameterIndex,
                      java.lang.String x)
               throws java.sql.SQLException
Specified by:
setString in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setStringX

void setStringX(int parameterIndex,
                java.lang.String x)
          throws SqlException
Throws:
SqlException

setBytes

public void setBytes(int parameterIndex,
                     byte[] x)
              throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setBytesX

public void setBytesX(int parameterIndex,
                      byte[] x)
               throws SqlException
Throws:
SqlException

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x,
                            long length)
                     throws java.sql.SQLException
sets the parameter to the Binary Stream object

Specified by:
setBinaryStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the binary parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x,
                            int length)
                     throws java.sql.SQLException
sets the parameter to the Binary Stream object

Specified by:
setBinaryStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the binary parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

setBinaryStreamX

protected void setBinaryStreamX(int parameterIndex,
                                java.io.InputStream x,
                                int length)
                         throws SqlException
Throws:
SqlException

setAsciiStream

public void setAsciiStream(int parameterIndex,
                           java.io.InputStream x,
                           long length)
                    throws java.sql.SQLException
We do this inefficiently and read it all in here. The target type is assumed to be a String.

Specified by:
setAsciiStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the ASCII parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

setAsciiStream

public void setAsciiStream(int parameterIndex,
                           java.io.InputStream x,
                           int length)
                    throws java.sql.SQLException
We do this inefficiently and read it all in here. The target type is assumed to be a String.

Specified by:
setAsciiStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the ASCII parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

checkStreamLength

private void checkStreamLength(long length)
                        throws java.sql.SQLException
Check the length passed in for the stream that is to be set. If length is larger than Integer.MAX_VALUE or smaller that 0, we fail by throwing an SQLException.

Parameters:
length - The length of the stream being set
Throws:
java.sql.SQLException - Thrown for a negative or too large length.

checkTypeForSetAsciiStream

private void checkTypeForSetAsciiStream(int parameterIndex)
                                 throws SqlException,
                                        java.sql.SQLException
Throws:
SqlException
java.sql.SQLException

checkTypeForSetBinaryStream

private void checkTypeForSetBinaryStream(int parameterIndex)
                                  throws SqlException,
                                         java.sql.SQLException
Throws:
SqlException
java.sql.SQLException

checkTypeForSetCharacterStream

private void checkTypeForSetCharacterStream(int parameterIndex)
                                     throws SqlException,
                                            java.sql.SQLException
Throws:
SqlException
java.sql.SQLException

checkTypeForSetBlob

private void checkTypeForSetBlob(int parameterIndex)
                          throws SqlException,
                                 java.sql.SQLException
Throws:
SqlException
java.sql.SQLException

checkTypeForSetClob

private void checkTypeForSetClob(int parameterIndex)
                          throws SqlException,
                                 java.sql.SQLException
Throws:
SqlException
java.sql.SQLException

setUnicodeStream

public void setUnicodeStream(int parameterIndex,
                             java.io.InputStream x,
                             int length)
                      throws java.sql.SQLException
Deprecated. 

Sets the specified parameter to the given input stream. Deprecated in JDBC 3.0 and this method will always just throw a feature not implemented exception.

Specified by:
setUnicodeStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the UNICODE parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - throws feature not implemented.

setCharacterStream

public void setCharacterStream(int parameterIndex,
                               java.io.Reader x)
                        throws java.sql.SQLException
Sets the designated parameter to the given Reader object. 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 object. 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.

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java.io.Reader object that contains the Unicode data
Throws:
java.sql.SQLException - if a database access error occurs or this method is called on a closed PreparedStatement

setCharacterStream

public void setCharacterStream(int parameterIndex,
                               java.io.Reader x,
                               long length)
                        throws java.sql.SQLException
Sets the designated parameter to the given Reader, which will have the specified number of bytes.

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the index of the parameter to which this set method is applied
x - the java Reader which contains the UNICODE value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

setCharacterStream

public void setCharacterStream(int parameterIndex,
                               java.io.Reader x,
                               int length)
                        throws java.sql.SQLException
Sets the designated parameter to the given Reader, which will have the specified number of bytes.

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
parameterIndex - the index of the parameter to which this set method is applied
x - the java Reader which contains the UNICODE value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - thrown on failure.

setBlob

public void setBlob(int parameterIndex,
                    java.sql.Blob x)
             throws java.sql.SQLException
Specified by:
setBlob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setBlobX

public void setBlobX(int parameterIndex,
                     java.sql.Blob x)
              throws SqlException
Throws:
SqlException

setClob

public void setClob(int parameterIndex,
                    java.sql.Clob x)
             throws java.sql.SQLException
Specified by:
setClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setClobX

void setClobX(int parameterIndex,
              java.sql.Clob x)
        throws SqlException
Throws:
SqlException

setArray

public void setArray(int parameterIndex,
                     java.sql.Array x)
              throws java.sql.SQLException
Specified by:
setArray in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setRef

public void setRef(int parameterIndex,
                   java.sql.Ref x)
            throws java.sql.SQLException
Specified by:
setRef in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setObject

public void setObject(int parameterIndex,
                      java.lang.Object x)
               throws java.sql.SQLException
Specified by:
setObject in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setUDTX

private void setUDTX(int parameterIndex,
                     java.lang.Object x)
              throws SqlException,
                     java.sql.SQLException
Set a UDT parameter to an object value.

Throws:
SqlException
java.sql.SQLException

setObject

public void setObject(int parameterIndex,
                      java.lang.Object x,
                      int targetJdbcType)
               throws java.sql.SQLException
Specified by:
setObject in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setObject

public void setObject(int parameterIndex,
                      java.lang.Object x,
                      int targetJdbcType,
                      int scale)
               throws java.sql.SQLException
Specified by:
setObject in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

setObjectX

private void setObjectX(int parameterIndex,
                        java.lang.Object x,
                        int targetJdbcType,
                        int scale)
                 throws SqlException
Throws:
SqlException

clearParameters

public void clearParameters()
                     throws java.sql.SQLException
Specified by:
clearParameters in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

execute

public boolean execute()
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

executeX

boolean executeX()
           throws SqlException
Throws:
SqlException

addBatch

public void addBatch()
              throws java.sql.SQLException
Specified by:
addBatch in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException,
                          BatchUpdateException
Specified by:
executeBatch in interface java.sql.Statement
Overrides:
executeBatch in class Statement
Throws:
java.sql.SQLException
BatchUpdateException

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

getMetaDataX

private ColumnMetaData getMetaDataX()
                             throws SqlException
Throws:
SqlException

execute

public boolean execute(java.lang.String sql,
                       int autoGeneratedKeys)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Overrides:
execute in class Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       java.lang.String[] columnNames)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Overrides:
execute in class Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       int[] columnIndexes)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Overrides:
execute in class Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int autoGeneratedKeys)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Overrides:
executeUpdate in class Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         java.lang.String[] columnNames)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Overrides:
executeUpdate in class Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int[] columnIndexes)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Overrides:
executeUpdate in class Statement
Throws:
java.sql.SQLException

setURL

public void setURL(int parameterIndex,
                   java.net.URL x)
            throws java.sql.SQLException
Specified by:
setURL in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

getParameterMetaData

public java.sql.ParameterMetaData getParameterMetaData()
                                                throws java.sql.SQLException
Specified by:
getParameterMetaData in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException

getParameterMetaDataX

private ParameterMetaData getParameterMetaDataX()
                                         throws SqlException
Throws:
SqlException

getColumnMetaDataX

private ColumnMetaData getColumnMetaDataX()
                                   throws SqlException
Throws:
SqlException

writeExecute

public void writeExecute(Section section,
                         ColumnMetaData parameterMetaData,
                         java.lang.Object[] inputs,
                         int numInputColumns,
                         boolean outputExpected,
                         boolean chainedWritesFollowingSetLob)
                  throws SqlException
Throws:
SqlException

readExecute

public void readExecute()
                 throws SqlException
Throws:
SqlException

writeOpenQuery

private void writeOpenQuery(Section section,
                            int fetchSize,
                            int resultSetType,
                            int numInputColumns,
                            ColumnMetaData parameterMetaData,
                            java.lang.Object[] inputs)
                     throws SqlException
Throws:
SqlException

writeDescribeInput

public void writeDescribeInput(Section section)
                        throws SqlException
Throws:
SqlException

readDescribeInput

public void readDescribeInput()
                       throws SqlException
Throws:
SqlException

completeDescribeInput

public void completeDescribeInput(ColumnMetaData parameterMetaData,
                                  Sqlca sqlca)
Specified by:
completeDescribeInput in interface PreparedStatementCallbackInterface

writeDescribeOutput

public void writeDescribeOutput(Section section)
                         throws SqlException
Throws:
SqlException

readDescribeOutput

public void readDescribeOutput()
                        throws SqlException
Throws:
SqlException

completeDescribeOutput

public void completeDescribeOutput(ColumnMetaData resultSetMetaData,
                                   Sqlca sqlca)
Specified by:
completeDescribeOutput in interface PreparedStatementCallbackInterface

writePrepareDescribeInputOutput

void writePrepareDescribeInputOutput()
                               throws SqlException
Throws:
SqlException

readPrepareDescribeInputOutput

void readPrepareDescribeInputOutput()
                              throws SqlException
Throws:
SqlException

writePrepareDescribeInput

void writePrepareDescribeInput()
                         throws SqlException
Throws:
SqlException

readPrepareDescribeInput

void readPrepareDescribeInput()
                        throws SqlException
Throws:
SqlException

completePrepareDescribe

void completePrepareDescribe()

expandObjectArray

private java.lang.Object[] expandObjectArray(java.lang.Object[] array,
                                             int newLength)

expandBooleanArray

private boolean[] expandBooleanArray(boolean[] array,
                                     int newLength)

writePrepareDescribeInputOutput

void writePrepareDescribeInputOutput(java.lang.String sql,
                                     Section section)
                               throws SqlException
Throws:
SqlException

flowPrepareDescribeInputOutput

void flowPrepareDescribeInputOutput()
                              throws SqlException
Throws:
SqlException

flowExecute

private void flowExecute(int executeType)
                  throws SqlException
Throws:
SqlException

executeBatchX

public int[] executeBatchX(boolean supportsQueryBatchRequest)
                    throws SqlException,
                           java.sql.SQLException,
                           BatchUpdateException
Throws:
SqlException
java.sql.SQLException
BatchUpdateException

executeBatchRequestX

private int[] executeBatchRequestX(boolean supportsQueryBatchRequest)
                            throws SqlException,
                                   BatchUpdateException
Throws:
SqlException
BatchUpdateException

listenToUnitOfWork

public void listenToUnitOfWork()
Specified by:
listenToUnitOfWork in interface UnitOfWorkListener
Overrides:
listenToUnitOfWork in class Statement

completeLocalCommit

public void completeLocalCommit(java.util.Iterator listenerIterator)
Specified by:
completeLocalCommit in interface UnitOfWorkListener
Overrides:
completeLocalCommit in class Statement

completeLocalRollback

public void completeLocalRollback(java.util.Iterator listenerIterator)
Specified by:
completeLocalRollback in interface UnitOfWorkListener
Overrides:
completeLocalRollback in class Statement

getJdbcStatementInterfaceName

protected java.lang.String getJdbcStatementInterfaceName()
Returns the name of the java.sql interface implemented by this class.

Overrides:
getJdbcStatementInterfaceName in class Statement
Returns:
name of java.sql interface

checkForValidParameterIndex

void checkForValidParameterIndex(int parameterIndex)
                           throws SqlException
Throws:
SqlException

checkThatAllParametersAreSet

private void checkThatAllParametersAreSet()
                                   throws SqlException
Throws:
SqlException

checkForValidScale

void checkForValidScale(int scale)
                  throws SqlException
Throws:
SqlException

checkForSupportedDataType

private void checkForSupportedDataType(int dataType)
                                throws SqlException
Checks whether a data type is supported for setObject(int, Object, int) and setObject(int, Object, int, int).

Parameters:
dataType - the data type to check
Throws:
SqlException - if the type is not supported

checkScaleForINOUTDecimal

void checkScaleForINOUTDecimal(int parameterIndex,
                               int registerOutScale)
                         throws SqlException
Throws:
SqlException

markClosed

protected void markClosed(boolean removeListener)
Description copied from class: Statement
This method cleans up client-side resources held by this Statement. If removeListener is true, the Statement is removed from open statements list and PreparedStatement is also removed from commit and rollback listeners list. This is called from the close methods.

Overrides:
markClosed in class Statement
Parameters:
removeListener - if true the Statement will be removed from the open statements list and PreparedStatement will also be removed from commit and rollback listeners list in org.apache.derby.client.am.Connection.

setAsciiStream

public void setAsciiStream(int parameterIndex,
                           java.io.InputStream x)
                    throws java.sql.SQLException
Sets the designated parameter to the given input stream. When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.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.

Specified by:
setAsciiStream in interface java.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 closed PreparedStatement

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x)
                     throws java.sql.SQLException
Sets the designated parameter to the given input stream. When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream object. The data will be read from the stream as needed until end-of-file is reached.

Specified by:
setBinaryStream in interface java.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 closed PreparedStatement

setClob

public void setClob(int parameterIndex,
                    java.io.Reader reader)
             throws java.sql.SQLException
Sets the designated parameter to a Reader object.

Specified by:
setClob in interface java.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 parameterIndex does not correspond to a parameter marker in the SQL statement; 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.SQLException
Sets the designated parameter to a Reader object.

Specified by:
setClob in interface java.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.SQLException
Sets the designated parameter to a InputStream object. This method differs from the setBinaryStream(int, InputStream) method because it informs the driver that the parameter value should be sent to the server as a BLOB. When the setBinaryStream method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a LONGVARBINARY or a BLOB

Specified by:
setBlob in interface java.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 closed PreparedStatement or if parameterIndex does 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.SQLException
Sets the designated parameter to a InputStream object.

Specified by:
setBlob in interface java.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.

checkStatementValidity

private void checkStatementValidity(SqlException sqle)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.