public class JdbcStatement extends TraceObject implements Statement
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closedByResultSet |
protected JdbcConnection |
conn |
protected int |
fetchSize |
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, SQL_EXCEPTION, STATEMENT, trace, XA_DATA_SOURCE, XA_RESOURCE, XIDCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Modifier and Type | Method and Description |
|---|---|
void |
addBatch(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.
|
boolean |
execute(String sql)
Executes an arbitrary statement.
|
boolean |
execute(String sql,
int autoGeneratedKeys)
Executes a statement and returns the update count.
|
boolean |
execute(String sql,
int[] columnIndexes)
Executes a statement and returns the update count.
|
boolean |
execute(String sql,
String[] columnNames)
Executes a statement and returns the update count.
|
int[] |
executeBatch()
Executes the batch.
|
ResultSet |
executeQuery(String sql)
Executes a query (select statement) and returns the result set.
|
int |
executeUpdate(String sql)
Executes a statement (insert, update, delete, create, drop)
and returns the update count.
|
int |
executeUpdate(String sql,
int autoGeneratedKeys)
Executes a statement and returns the update count.
|
int |
executeUpdate(String sql,
int[] columnIndexes)
Executes a statement and returns the update count.
|
int |
executeUpdate(String sql,
String[] columnNames)
Executes a statement and returns the update count.
|
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.
|
ResultSet |
getGeneratedKeys()
Return a result set that contains the last generated auto-increment key
for this connection, if there was one.
|
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.
|
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.
|
SQLWarning |
getWarnings()
Gets the first warning reported by calls on this object.
|
boolean |
isClosed()
Returns whether this statement is closed.
|
boolean |
isPoolable()
Returns whether this object is poolable.
|
void |
setCursorName(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 |
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.
|
String |
toString()
INTERNAL
|
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTrace, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupportedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseOnCompletion, isCloseOnCompletionisWrapperFor, unwrapprotected JdbcConnection conn
protected SessionInterface session
protected JdbcResultSet resultSet
protected int maxRows
protected int fetchSize
protected int updateCount
protected final int resultSetType
protected final int resultSetConcurrency
protected boolean closedByResultSet
public ResultSet executeQuery(String sql) throws SQLException
executeQuery in interface Statementsql - the SQL statement to executeSQLExceptionpublic int executeUpdate(String sql) throws SQLException
executeUpdate in interface Statementsql - the SQL statementSQLException - if a database error occurred or a
select statement was executedpublic boolean execute(String sql) throws SQLException
execute in interface Statementsql - the SQL statement to executeSQLExceptionpublic ResultSet getResultSet() throws SQLException
getResultSet in interface StatementSQLExceptionpublic int getUpdateCount()
throws SQLException
getUpdateCount in interface StatementSQLException - if this object is closed or invalidpublic void close()
throws SQLException
close in interface AutoCloseableclose in interface StatementSQLExceptionpublic Connection getConnection()
getConnection in interface Statementpublic SQLWarning getWarnings() throws SQLException
getWarnings in interface StatementSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface StatementSQLExceptionpublic boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLException - if this object is closed.public void setCursorName(String name) throws SQLException
setCursorName in interface Statementname - ignoredSQLException - if this object is closedpublic void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface Statementdirection - ignoredSQLException - if this object is closedpublic int getFetchDirection()
throws SQLException
getFetchDirection in interface StatementSQLException - if this object is closedpublic int getMaxRows()
throws SQLException
getMaxRows in interface StatementSQLException - if this object is closedpublic void setMaxRows(int maxRows)
throws SQLException
setMaxRows in interface StatementmaxRows - the number of rows where 0 means no limitSQLException - if this object is closedpublic void setFetchSize(int rows)
throws SQLException
setFetchSize in interface Statementrows - the number of rowsSQLException - if this object is closedpublic int getFetchSize()
throws SQLException
getFetchSize in interface StatementSQLException - if this object is closedpublic int getResultSetConcurrency()
throws SQLException
getResultSetConcurrency in interface StatementSQLExceptionpublic int getResultSetType()
throws SQLException
getResultSetType in interface StatementSQLException - if this object is closedpublic int getMaxFieldSize()
throws SQLException
getMaxFieldSize in interface StatementSQLException - if this object is closedpublic void setMaxFieldSize(int max)
throws SQLException
setMaxFieldSize in interface Statementmax - the maximum size - ignoredSQLException - if this object is closedpublic void setEscapeProcessing(boolean enable)
throws SQLException
setEscapeProcessing in interface Statementenable - - true (default) or false (no conversion is attempted)SQLException - if this object is closedpublic void cancel()
throws SQLException
cancel in interface StatementSQLException - if this object is closedpublic int getQueryTimeout()
throws SQLException
getQueryTimeout in interface StatementSQLException - if this object is closedpublic void setQueryTimeout(int seconds)
throws SQLException
setQueryTimeout in interface Statementseconds - the timeout in seconds - 0 means no timeout, values
smaller 0 will throw an exceptionSQLException - if this object is closedpublic void addBatch(String sql) throws SQLException
addBatch in interface Statementsql - the SQL statementSQLExceptionpublic void clearBatch()
throws SQLException
clearBatch in interface StatementSQLExceptionpublic int[] executeBatch()
throws SQLException
executeBatch in interface StatementSQLExceptionpublic ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys in interface StatementSQLException - if this object is closedpublic boolean getMoreResults(int current)
throws SQLException
getMoreResults in interface Statementcurrent - Statement.CLOSE_CURRENT_RESULT,
Statement.KEEP_CURRENT_RESULT,
or Statement.CLOSE_ALL_RESULTSSQLExceptionpublic int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate in interface Statementsql - the SQL statementautoGeneratedKeys - ignoredSQLException - if a database error occurred or a
select statement was executedpublic int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate in interface Statementsql - the SQL statementcolumnIndexes - ignoredSQLException - if a database error occurred or a
select statement was executedpublic int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate in interface Statementsql - the SQL statementcolumnNames - ignoredSQLException - if a database error occurred or a
select statement was executedpublic boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute in interface Statementsql - the SQL statementautoGeneratedKeys - ignoredSQLException - if a database error occurred or a
select statement was executedpublic boolean execute(String sql, int[] columnIndexes) throws SQLException
execute in interface Statementsql - the SQL statementcolumnIndexes - ignoredSQLException - if a database error occurred or a
select statement was executedpublic boolean execute(String sql, String[] columnNames) throws SQLException
execute in interface Statementsql - the SQL statementcolumnNames - ignoredSQLException - if a database error occurred or a
select statement was executedpublic int getResultSetHoldability()
throws SQLException
getResultSetHoldability in interface StatementSQLExceptionprotected boolean checkClosed(boolean write)
write - if the next operation is possibly writingDbException - if it is closedprotected void closeOldResultSet()
throws SQLException
SQLExceptionprotected void setExecutingStatement(CommandInterface c)
c - the commandpublic int getLastExecutedCommandType()
public boolean isClosed()
throws SQLException
isClosed in interface StatementSQLExceptionpublic boolean isPoolable()
isPoolable in interface Statementpublic void setPoolable(boolean poolable)
setPoolable in interface Statementpoolable - the requested valueCopyright © 2012 JBoss by Red Hat. All Rights Reserved.