|
|||||||||
| Home >> All >> org >> apache >> derby >> client >> [ am overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.client.am
Class PreparedStatement

java.lang.Objectorg.apache.derby.client.am.Statement
org.apache.derby.client.am.PreparedStatement
- All Implemented Interfaces:
- java.sql.PreparedStatement, PreparedStatementCallbackInterface, java.sql.Statement, StatementCallbackInterface, UnitOfWorkListener
- Direct Known Subclasses:
- CallableStatement
- public class PreparedStatement
- extends Statement
- implements java.sql.PreparedStatement, PreparedStatementCallbackInterface
- extends Statement
| Field Summary | |
(package private) boolean |
listenToUnitOfWork_
|
MaterialPreparedStatement |
materialPreparedStatement_
|
boolean |
outputRegistered_
|
ColumnMetaData |
parameterMetaData_
|
(package private) boolean[] |
parameterRegistered_
|
java.lang.Object[] |
parameters_
|
(package private) boolean[] |
parameterSet_
|
(package private) java.lang.String |
positionedUpdateCursorName_
|
java.lang.String |
sql_
|
| 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)
|
|
PreparedStatement(Agent agent,
Connection connection,
java.lang.String sql,
Section section)
|
|
| Method Summary | |
void |
addBatch()
This method adds a set of parameters to the batch for JDBC 2.0. |
private int |
checkForEscapedCallWithResult(int parameterIndex)
|
(package private) void |
checkForValidParameterIndex(int parameterIndex)
|
(package private) void |
checkForValidScale(int scale)
|
(package private) void |
checkScaleForINOUTDecimal(int parameterIndex,
int registerOutScale)
|
private int |
checkSetterPreconditions(int parameterIndex)
|
private void |
checkThatAllParametersAreSet()
|
void |
clearParameters()
This method clears all of the input parameter that have been set on this statement. |
void |
close()
This method closes the statement and frees any associated resources. |
void |
closeX()
|
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()
This method executes a prepared SQL query. |
boolean |
execute(java.lang.String sql)
This method executes an arbitrary SQL statement of any time. |
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()
This method executes the SQL batch and returns an array of update counts - one for each SQL statement in the batch - ordered in the same order the statements were added to the batch. |
private int[] |
executeBatchRequestX(boolean supportsQueryBatchRequest)
|
int[] |
executeBatchX(boolean supportsQueryBatchRequest)
|
java.sql.ResultSet |
executeQuery()
This method executes a prepared SQL query and returns its ResultSet. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
This method executes the specified SQL SELECT statement and returns a (possibly empty) ResultSet with the results of the query. |
(package private) ResultSet |
executeQueryX()
|
int |
executeUpdate()
This method executes an SQL INSERT, UPDATE or DELETE statement. |
int |
executeUpdate(java.lang.String sql)
This method executes the specified SQL INSERT, UPDATE, or DELETE statement and returns the number of rows affected, which may be 0. |
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)
|
(package private) int |
executeUpdateX()
|
private boolean |
executeX()
|
private boolean[] |
expandBooleanArray(boolean[] array,
int newLength)
|
private java.lang.Object[] |
expandObjectArray(java.lang.Object[] array,
int newLength)
|
protected void |
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
(package private) void |
flowExecute(int executeType)
|
(package private) void |
flowPrepareDescribeInputOutput()
|
(package private) void |
flowPrepareForSelectFromInsert()
|
java.sql.ResultSetMetaData |
getMetaData()
This method returns meta data for the result set from this statement. |
private ColumnMetaData |
getMetaDataX()
|
java.sql.ParameterMetaData |
getParameterMetaData()
Returns information about the parameters set on this PreparedStatement (see ParameterMetaData for a
detailed description of the provided information). |
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()
|
(package private) void |
prepare()
|
void |
readDescribeInput()
|
void |
readDescribeOutput()
|
void |
readExecute()
|
(package private) void |
readPrepareDescribeInput()
|
(package private) void |
readPrepareDescribeInputOutput()
|
void |
reset(boolean fullReset)
|
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)
|
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)
This method sets the specified parameter from the given Java Array value. |
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
This method sets the specified parameter from the given Java ASCII InputStream value. |
void |
setBigDecimal(int parameterIndex,
java.math.BigDecimal x)
This method sets the specified parameter from the given Java java.math.BigDecimal value. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
This method sets the specified parameter from the given Java binary InputStream value. |
void |
setBinaryStreamX(int parameterIndex,
java.io.InputStream x,
int length)
|
void |
setBlob(int parameterIndex,
java.sql.Blob x)
This method sets the specified parameter from the given Java Blob value. |
void |
setBlobX(int parameterIndex,
java.sql.Blob x)
|
void |
setBoolean(int parameterIndex,
boolean x)
This method sets the specified parameter from the given Java boolean value. |
void |
setByte(int parameterIndex,
byte x)
This method sets the specified parameter from the given Java byte value. |
void |
setBytes(int parameterIndex,
byte[] x)
This method sets the specified parameter from the given Java byte array value. |
void |
setBytesX(int parameterIndex,
byte[] x)
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader x,
int length)
This method sets the specified parameter from the given Java character Reader value. |
void |
setClob(int parameterIndex,
java.sql.Clob x)
This method sets the specified parameter from the given Java Clob value. |
(package private) void |
setClobX(int parameterIndex,
java.sql.Clob x)
|
void |
setDate(int parameterIndex,
java.sql.Date x)
This method sets the specified parameter from the given Java java.sql.Date value. |
void |
setDate(int parameterIndex,
java.sql.Date x,
java.util.Calendar calendar)
This method sets the specified parameter from the given Java java.sql.Date value. |
void |
setDouble(int parameterIndex,
double x)
This method sets the specified parameter from the given Java double value. |
void |
setFloat(int parameterIndex,
float x)
This method sets the specified parameter from the given Java float value. |
(package private) void |
setInput(int parameterIndex,
java.lang.Object input)
|
void |
setInt(int parameterIndex,
int x)
This method sets the specified parameter from the given Java int value. |
(package private) void |
setIntX(int parameterIndex,
int x)
|
void |
setLong(int parameterIndex,
long x)
This method sets the specified parameter from the given Java long value. |
void |
setNull(int parameterIndex,
int jdbcType)
This method populates the specified parameter with a SQL NULL value for the specified type. |
void |
setNull(int parameterIndex,
int jdbcType,
java.lang.String typeName)
This method populates the specified parameter with a SQL NULL value for the specified type. |
(package private) void |
setNullX(int parameterIndex,
int jdbcType)
|
void |
setObject(int parameterIndex,
java.lang.Object x)
This method sets the specified parameter from the given Java Object value. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetJdbcType)
This method sets the specified parameter from the given Java Object value. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetJdbcType,
int scale)
This method sets the specified parameter from the given Java Object value. |
private void |
setObjectX(int parameterIndex,
java.lang.Object x,
int targetJdbcType,
int scale)
|
void |
setRef(int parameterIndex,
java.sql.Ref x)
This method sets the specified parameter from the given Java Ref value. |
void |
setShort(int parameterIndex,
short x)
This method sets the specified parameter from the given Java short value. |
(package private) void |
setShortX(int parameterIndex,
short x)
|
void |
setString(int parameterIndex,
java.lang.String x)
This method sets the specified parameter from the given Java String value. |
(package private) void |
setStringX(int parameterIndex,
java.lang.String x)
|
void |
setTime(int parameterIndex,
java.sql.Time x)
This method sets the specified parameter from the given Java java.sql.Time value. |
void |
setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar calendar)
This method sets the specified parameter from the given Java java.sql.Time value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x)
This method sets the specified parameter from the given Java java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar calendar)
This method sets the specified parameter from the given Java java.sql.Timestamp value. |
void |
setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
This method sets the specified parameter from the given Java Unicode UTF-8 InputStream value. |
void |
setURL(int parameterIndex,
java.net.URL x)
This method sets the specified parameter from the given Java java.net.URL value. |
void |
writeDescribeInput(Section section)
|
void |
writeDescribeOutput(Section section)
|
void |
writeExecute(Section section,
ColumnMetaData parameterMetaData,
java.lang.Object[] inputs,
int numInputColumns,
boolean outputExpected,
boolean chainedWritesFollowingSetLob)
|
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 java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Statement |
addBatch, cancel, clearBatch, clearWarnings, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout |
| 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_
positionedUpdateCursorName_
java.lang.String positionedUpdateCursorName_
listenToUnitOfWork_
boolean listenToUnitOfWork_
| Constructor Detail |
PreparedStatement
public PreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section) 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) throws SqlException
| Method Detail |
setInput
void setInput(int parameterIndex,
java.lang.Object input)
initPreparedStatement
private void initPreparedStatement()
initResetPreparedStatement
protected void initResetPreparedStatement()
- Overrides:
initResetPreparedStatementin classStatement
reset
public void reset(boolean fullReset)
throws SqlException
resetParameters
private void resetParameters()
resetPreparedStatement
public void resetPreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section) throws SqlException
initPreparedStatement
private void initPreparedStatement(java.lang.String sql, Section section) 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) throws SqlException
initPreparedStatement
private void initPreparedStatement(java.lang.String sql) throws SqlException
resetPreparedStatement
public void resetPreparedStatement(Agent agent, Connection connection, java.lang.String sql, Section section, ColumnMetaData parameterMetaData, ColumnMetaData resultSetMetaData) throws SqlException
initPreparedStatement
private void initPreparedStatement(ColumnMetaData parameterMetaData, ColumnMetaData resultSetMetaData) throws SqlException
finalize
protected void finalize()
throws java.lang.Throwable
- Description copied from class:
java.lang.Object - Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.refpackage.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize().finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize().The default implementation does nothing.
prepare
void prepare()
throws SqlException
execute
public boolean execute(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Statement - This method executes an arbitrary SQL statement of any time. The
methods
getResultSet,getMoreResultsandgetUpdateCountretrieve the results.- Specified by:
executein interfacejava.sql.Statement- Overrides:
executein classStatement
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL SELECT statement and returns a
(possibly empty)
ResultSetwith the results of the query.- Specified by:
executeQueryin interfacejava.sql.Statement- Overrides:
executeQueryin classStatement
executeUpdate
public int executeUpdate(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL INSERT, UPDATE, or DELETE statement
and returns the number of rows affected, which may be 0.
- Specified by:
executeUpdatein interfacejava.sql.Statement- Overrides:
executeUpdatein classStatement
executeQuery
public java.sql.ResultSet executeQuery() throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method executes a prepared SQL query and returns its ResultSet.
- Specified by:
executeQueryin interfacejava.sql.PreparedStatement
executeQueryX
ResultSet executeQueryX() throws SqlException
executeUpdate
public int executeUpdate()
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method executes an SQL INSERT, UPDATE or DELETE statement. SQL
statements that return nothing such as SQL DDL statements can be executed.
- Specified by:
executeUpdatein interfacejava.sql.PreparedStatement
executeUpdateX
int executeUpdateX()
throws SqlException
setNull
public void setNull(int parameterIndex,
int jdbcType)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method populates the specified parameter with a SQL NULL value
for the specified type.
- Specified by:
setNullin interfacejava.sql.PreparedStatement
setNullX
void setNullX(int parameterIndex,
int jdbcType)
throws SqlException
setNull
public void setNull(int parameterIndex,
int jdbcType,
java.lang.String typeName)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method populates the specified parameter with a SQL NULL value
for the specified type.
- Specified by:
setNullin interfacejava.sql.PreparedStatement
setBoolean
public void setBoolean(int parameterIndex,
boolean x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
booleanvalue.- Specified by:
setBooleanin interfacejava.sql.PreparedStatement
setByte
public void setByte(int parameterIndex,
byte x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
bytevalue.- Specified by:
setBytein interfacejava.sql.PreparedStatement
setShort
public void setShort(int parameterIndex,
short x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
shortvalue.- Specified by:
setShortin interfacejava.sql.PreparedStatement
setShortX
void setShortX(int parameterIndex,
short x)
throws SqlException
setInt
public void setInt(int parameterIndex,
int x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
intvalue.- Specified by:
setIntin interfacejava.sql.PreparedStatement
setIntX
void setIntX(int parameterIndex,
int x)
throws SqlException
setLong
public void setLong(int parameterIndex,
long x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
longvalue.- Specified by:
setLongin interfacejava.sql.PreparedStatement
setFloat
public void setFloat(int parameterIndex,
float x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
floatvalue.- Specified by:
setFloatin interfacejava.sql.PreparedStatement
setDouble
public void setDouble(int parameterIndex,
double x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
doublevalue.- Specified by:
setDoublein interfacejava.sql.PreparedStatement
setBigDecimal
public void setBigDecimal(int parameterIndex,
java.math.BigDecimal x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.math.BigDecimalvalue.- Specified by:
setBigDecimalin interfacejava.sql.PreparedStatement
setDate
public void setDate(int parameterIndex,
java.sql.Date x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Datevalue.- Specified by:
setDatein interfacejava.sql.PreparedStatement
setDate
public void setDate(int parameterIndex,
java.sql.Date x,
java.util.Calendar calendar)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Datevalue.- Specified by:
setDatein interfacejava.sql.PreparedStatement
setTime
public void setTime(int parameterIndex,
java.sql.Time x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Timevalue.- Specified by:
setTimein interfacejava.sql.PreparedStatement
setTime
public void setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar calendar)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Timevalue.- Specified by:
setTimein interfacejava.sql.PreparedStatement
setTimestamp
public void setTimestamp(int parameterIndex,
java.sql.Timestamp x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Timestampvalue.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement
setTimestamp
public void setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar calendar)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
java.sql.Timestampvalue.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement
setString
public void setString(int parameterIndex,
java.lang.String x)
throws SqlException
- Description copied from interface:
java.sql.PreparedStatement - This method sets the specified parameter from the given Java
Stringvalue.<
JAVADOC