public class JdbcStatement extends TraceObject implements java.sql.Statement, JdbcStatementBackwardsCompat
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closedByResultSet |
protected JdbcConnection |
conn |
protected int |
fetchSize |
protected JdbcResultSet |
generatedKeys |
protected int |
maxRows |
protected JdbcResultSet |
resultSet |
protected int |
resultSetConcurrency |
protected int |
resultSetType |
protected SessionInterface |
session |
protected int |
updateCount |
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, STATEMENT, trace, XA_DATA_SOURCE, XID| Modifier and Type | Method and Description |
|---|---|
void |
addBatch(java.lang.String sql)
Adds a statement to the batch.
|
void |
cancel()
Cancels a currently running statement.
|
protected boolean |
checkClosed(boolean write)
INTERNAL.
|
void |
clearBatch()
Clears the batch.
|
void |
clearWarnings()
Clears all warnings.
|
void |
close()
Closes this statement.
|
protected void |
closeOldResultSet()
INTERNAL.
|
void |
closeOnCompletion()
[Not supported]
|
java.lang.String |
enquoteIdentifier(java.lang.String identifier,
boolean alwaysQuote)
Enquotes the specified identifier.
|
boolean |
execute(java.lang.String sql)
Executes an arbitrary statement.
|
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys)
Executes a statement and returns the update count.
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
Executes a statement and returns the update count.
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
Executes a statement and returns the update count.
|
int[] |
executeBatch()
Executes the batch.
|
long[] |
executeLargeBatch()
Executes the batch.
|
long |
executeLargeUpdate(java.lang.String sql)
Executes a statement (insert, update, delete, create, drop)
and returns the update count.
|
long |
executeLargeUpdate(java.lang.String sql,
int autoGeneratedKeys)
Executes a statement and returns the update count.
|
long |
executeLargeUpdate(java.lang.String sql,
int[] columnIndexes)
Executes a statement and returns the update count.
|
long |
executeLargeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
Executes a statement and returns the update count.
|
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Executes a query (select statement) and returns the result set.
|
int |
executeUpdate(java.lang.String sql)
Executes a statement (insert, update, delete, create, drop)
and returns the update count.
|
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
Executes a statement and returns the update count.
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
Executes a statement and returns the update count.
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
Executes a statement and returns the update count.
|
java.sql.Connection |
getConnection()
Returns the connection that created this object.
|
int |
getFetchDirection()
Gets the fetch direction.
|
int |
getFetchSize()
Gets the number of rows suggested to read in one step.
|
java.sql.ResultSet |
getGeneratedKeys()
Return a result set that contains the last generated auto-increment key
for this connection, if there was one.
|
long |
getLargeMaxRows()
Gets the maximum number of rows for a ResultSet.
|
long |
getLargeUpdateCount()
Returns the last update count of this statement.
|
int |
getLastExecutedCommandType()
INTERNAL.
|
int |
getMaxFieldSize()
Gets the maximum number of bytes for a result set column.
|
int |
getMaxRows()
Gets the maximum number of rows for a ResultSet.
|
boolean |
getMoreResults()
Moves to the next result set - however there is always only one result
set.
|
boolean |
getMoreResults(int current)
Move to the next result set.
|
int |
getQueryTimeout()
Gets the current query timeout in seconds.
|
java.sql.ResultSet |
getResultSet()
Returns the last result set produces by this statement.
|
int |
getResultSetConcurrency()
Gets the result set concurrency created by this object.
|
int |
getResultSetHoldability()
Gets the result set holdability.
|
int |
getResultSetType()
Gets the result set type.
|
int |
getUpdateCount()
Returns the last update count of this statement.
|
java.sql.SQLWarning |
getWarnings()
Gets the first warning reported by calls on this object.
|
boolean |
isCancelled()
Check whether the statement was cancelled.
|
boolean |
isClosed()
Returns whether this statement is closed.
|
boolean |
isCloseOnCompletion()
[Not supported]
|
boolean |
isPoolable()
Returns whether this object is poolable.
|
boolean |
isSimpleIdentifier(java.lang.String identifier)
Checks if specified identifier may be used without quotes.
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Checks if unwrap can return an object of this class.
|
void |
setCursorName(java.lang.String name)
Sets the name of the cursor.
|
void |
setEscapeProcessing(boolean enable)
Enables or disables processing or JDBC escape syntax.
|
protected void |
setExecutingStatement(CommandInterface c)
INTERNAL.
|
void |
setFetchDirection(int direction)
Sets the fetch direction.
|
void |
setFetchSize(int rows)
Sets the number of rows suggested to read in one step.
|
void |
setLargeMaxRows(long maxRows)
Gets the maximum number of rows for a ResultSet.
|
void |
setMaxFieldSize(int max)
Sets the maximum number of bytes for a result set column.
|
void |
setMaxRows(int maxRows)
Gets the maximum number of rows for a ResultSet.
|
void |
setPoolable(boolean poolable)
Requests that this object should be pooled or not.
|
void |
setQueryTimeout(int seconds)
Sets the current query timeout in seconds.
|
java.lang.String |
toString()
INTERNAL
|
<T> T |
unwrap(java.lang.Class<T> iface)
Return an object of this class if possible.
|
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupportedprotected JdbcConnection conn
protected SessionInterface session
protected JdbcResultSet resultSet
protected int maxRows
protected int fetchSize
protected int updateCount
protected JdbcResultSet generatedKeys
protected final int resultSetType
protected final int resultSetConcurrency
protected final boolean closedByResultSet
public java.sql.ResultSet executeQuery(java.lang.String sql)
throws java.sql.SQLException
executeQuery in interface java.sql.Statementsql - the SQL statement to executejava.sql.SQLExceptionpublic int executeUpdate(java.lang.String sql)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementsql - the SQL statementjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic long executeLargeUpdate(java.lang.String sql)
throws java.sql.SQLException
executeLargeUpdate in interface java.sql.StatementexecuteLargeUpdate in interface JdbcStatementBackwardsCompatsql - the SQL statementjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic boolean execute(java.lang.String sql)
throws java.sql.SQLException
execute in interface java.sql.Statementsql - the SQL statement to executejava.sql.SQLExceptionpublic java.sql.ResultSet getResultSet()
throws java.sql.SQLException
getResultSet in interface java.sql.Statementjava.sql.SQLExceptionpublic int getUpdateCount()
throws java.sql.SQLException
getUpdateCount in interface java.sql.Statementjava.sql.SQLException - if this object is closed or invalidpublic long getLargeUpdateCount()
throws java.sql.SQLException
getLargeUpdateCount in interface java.sql.StatementgetLargeUpdateCount in interface JdbcStatementBackwardsCompatjava.sql.SQLException - if this object is closed or invalidpublic void close()
throws java.sql.SQLException
close in interface java.lang.AutoCloseableclose in interface java.sql.Statementjava.sql.SQLExceptionpublic java.sql.Connection getConnection()
getConnection in interface java.sql.Statementpublic java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Statementjava.sql.SQLExceptionpublic void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Statementjava.sql.SQLExceptionpublic void setCursorName(java.lang.String name)
throws java.sql.SQLException
setCursorName in interface java.sql.Statementname - ignoredjava.sql.SQLException - if this object is closedpublic void setFetchDirection(int direction)
throws java.sql.SQLException
setFetchDirection in interface java.sql.Statementdirection - ignoredjava.sql.SQLException - if this object is closedpublic int getFetchDirection()
throws java.sql.SQLException
getFetchDirection in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic int getMaxRows()
throws java.sql.SQLException
getMaxRows in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic long getLargeMaxRows()
throws java.sql.SQLException
getLargeMaxRows in interface java.sql.StatementgetLargeMaxRows in interface JdbcStatementBackwardsCompatjava.sql.SQLException - if this object is closedpublic void setMaxRows(int maxRows)
throws java.sql.SQLException
setMaxRows in interface java.sql.StatementmaxRows - the number of rows where 0 means no limitjava.sql.SQLException - if this object is closedpublic void setLargeMaxRows(long maxRows)
throws java.sql.SQLException
setLargeMaxRows in interface java.sql.StatementsetLargeMaxRows in interface JdbcStatementBackwardsCompatmaxRows - the number of rows where 0 means no limitjava.sql.SQLException - if this object is closedpublic void setFetchSize(int rows)
throws java.sql.SQLException
setFetchSize in interface java.sql.Statementrows - the number of rowsjava.sql.SQLException - if this object is closedpublic int getFetchSize()
throws java.sql.SQLException
getFetchSize in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic int getResultSetConcurrency()
throws java.sql.SQLException
getResultSetConcurrency in interface java.sql.Statementjava.sql.SQLExceptionpublic int getResultSetType()
throws java.sql.SQLException
getResultSetType in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic int getMaxFieldSize()
throws java.sql.SQLException
getMaxFieldSize in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic void setMaxFieldSize(int max)
throws java.sql.SQLException
setMaxFieldSize in interface java.sql.Statementmax - the maximum size - ignoredjava.sql.SQLException - if this object is closedpublic void setEscapeProcessing(boolean enable)
throws java.sql.SQLException
setEscapeProcessing in interface java.sql.Statementenable - - true (default) or false (no conversion is attempted)java.sql.SQLException - if this object is closedpublic void cancel()
throws java.sql.SQLException
cancel in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic boolean isCancelled()
public int getQueryTimeout()
throws java.sql.SQLException
getQueryTimeout in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic void setQueryTimeout(int seconds)
throws java.sql.SQLException
setQueryTimeout in interface java.sql.Statementseconds - the timeout in seconds - 0 means no timeout, values
smaller 0 will throw an exceptionjava.sql.SQLException - if this object is closedpublic void addBatch(java.lang.String sql)
throws java.sql.SQLException
addBatch in interface java.sql.Statementsql - the SQL statementjava.sql.SQLExceptionpublic void clearBatch()
throws java.sql.SQLException
clearBatch in interface java.sql.Statementjava.sql.SQLExceptionpublic int[] executeBatch()
throws java.sql.SQLException
executeBatch in interface java.sql.Statementjava.sql.SQLExceptionpublic long[] executeLargeBatch()
throws java.sql.SQLException
executeLargeBatch in interface java.sql.StatementexecuteLargeBatch in interface JdbcStatementBackwardsCompatjava.sql.SQLExceptionpublic java.sql.ResultSet getGeneratedKeys()
throws java.sql.SQLException
getGeneratedKeys in interface java.sql.Statementjava.sql.SQLException - if this object is closedpublic boolean getMoreResults()
throws java.sql.SQLException
getMoreResults in interface java.sql.Statementjava.sql.SQLException - if this object is closed.public boolean getMoreResults(int current)
throws java.sql.SQLException
getMoreResults in interface java.sql.Statementcurrent - Statement.CLOSE_CURRENT_RESULT,
Statement.KEEP_CURRENT_RESULT,
or Statement.CLOSE_ALL_RESULTSjava.sql.SQLExceptionpublic int executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementsql - the SQL statementautoGeneratedKeys - Statement.RETURN_GENERATED_KEYS if generated keys should
be available for retrieval, Statement.NO_GENERATED_KEYS if
generated keys should not be availablejava.sql.SQLException - if a database error occurred or a
select statement was executedpublic long executeLargeUpdate(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
executeLargeUpdate in interface java.sql.StatementexecuteLargeUpdate in interface JdbcStatementBackwardsCompatsql - the SQL statementautoGeneratedKeys - Statement.RETURN_GENERATED_KEYS if generated keys should
be available for retrieval, Statement.NO_GENERATED_KEYS if
generated keys should not be availablejava.sql.SQLException - if a database error occurred or a
select statement was executedpublic int executeUpdate(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementsql - the SQL statementcolumnIndexes - an array of column indexes indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic long executeLargeUpdate(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
executeLargeUpdate in interface java.sql.StatementexecuteLargeUpdate in interface JdbcStatementBackwardsCompatsql - the SQL statementcolumnIndexes - an array of column indexes indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic int executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementsql - the SQL statementcolumnNames - an array of column names indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic long executeLargeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
executeLargeUpdate in interface java.sql.StatementexecuteLargeUpdate in interface JdbcStatementBackwardsCompatsql - the SQL statementcolumnNames - an array of column names indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic boolean execute(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
execute in interface java.sql.Statementsql - the SQL statementautoGeneratedKeys - Statement.RETURN_GENERATED_KEYS if generated keys should
be available for retrieval, Statement.NO_GENERATED_KEYS if
generated keys should not be availablejava.sql.SQLException - if a database error occurred or a
select statement was executedpublic boolean execute(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
execute in interface java.sql.Statementsql - the SQL statementcolumnIndexes - an array of column indexes indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic boolean execute(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
execute in interface java.sql.Statementsql - the SQL statementcolumnNames - an array of column names indicating the columns with generated
keys that should be returned from the inserted rowjava.sql.SQLException - if a database error occurred or a
select statement was executedpublic int getResultSetHoldability()
throws java.sql.SQLException
getResultSetHoldability in interface java.sql.Statementjava.sql.SQLExceptionpublic void closeOnCompletion()
closeOnCompletion in interface java.sql.Statementpublic boolean isCloseOnCompletion()
isCloseOnCompletion in interface java.sql.Statementprotected boolean checkClosed(boolean write)
write - if the next operation is possibly writingDbException - if it is closedprotected void closeOldResultSet()
throws java.sql.SQLException
java.sql.SQLExceptionprotected void setExecutingStatement(CommandInterface c)
c - the commandpublic int getLastExecutedCommandType()
public boolean isClosed()
throws java.sql.SQLException
isClosed in interface java.sql.Statementjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperiface - the classjava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperiface - the classjava.sql.SQLExceptionpublic boolean isPoolable()
isPoolable in interface java.sql.Statementpublic void setPoolable(boolean poolable)
setPoolable in interface java.sql.Statementpoolable - the requested valuepublic java.lang.String enquoteIdentifier(java.lang.String identifier,
boolean alwaysQuote)
throws java.sql.SQLException
JdbcStatementBackwardsCompatenquoteIdentifier in interface JdbcStatementBackwardsCompatidentifier - identifier to quote if requiredalwaysQuote - if true identifier will be quoted unconditionallyjava.sql.SQLExceptionpublic boolean isSimpleIdentifier(java.lang.String identifier)
throws java.sql.SQLException
JdbcStatementBackwardsCompatisSimpleIdentifier in interface JdbcStatementBackwardsCompatidentifier - identifier to checkjava.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Object