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, XID
CLOSE_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, unsupported
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
closeOnCompletion, isCloseOnCompletion
isWrapperFor, unwrap
protected 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 Statement
sql
- the SQL statement to executeSQLException
public int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
sql
- the SQL statementSQLException
- if a database error occurred or a
select statement was executedpublic boolean execute(String sql) throws SQLException
execute
in interface Statement
sql
- the SQL statement to executeSQLException
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
- if this object is closed or invalidpublic void close() throws SQLException
close
in interface AutoCloseable
close
in interface Statement
SQLException
public Connection getConnection()
getConnection
in interface Statement
public SQLWarning getWarnings() throws SQLException
getWarnings
in interface Statement
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
- if this object is closed.public void setCursorName(String name) throws SQLException
setCursorName
in interface Statement
name
- ignoredSQLException
- if this object is closedpublic void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
direction
- ignoredSQLException
- if this object is closedpublic int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
- if this object is closedpublic int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
- if this object is closedpublic void setMaxRows(int maxRows) throws SQLException
setMaxRows
in interface Statement
maxRows
- the number of rows where 0 means no limitSQLException
- if this object is closedpublic void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
rows
- the number of rowsSQLException
- if this object is closedpublic int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
- if this object is closedpublic int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
public int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
- if this object is closedpublic int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
- if this object is closedpublic void setMaxFieldSize(int max) throws SQLException
setMaxFieldSize
in interface Statement
max
- the maximum size - ignoredSQLException
- if this object is closedpublic void setEscapeProcessing(boolean enable) throws SQLException
setEscapeProcessing
in interface Statement
enable
- - true (default) or false (no conversion is attempted)SQLException
- if this object is closedpublic void cancel() throws SQLException
cancel
in interface Statement
SQLException
- if this object is closedpublic int getQueryTimeout() throws SQLException
getQueryTimeout
in interface Statement
SQLException
- if this object is closedpublic void setQueryTimeout(int seconds) throws SQLException
setQueryTimeout
in interface Statement
seconds
- 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 Statement
sql
- the SQL statementSQLException
public void clearBatch() throws SQLException
clearBatch
in interface Statement
SQLException
public int[] executeBatch() throws SQLException
executeBatch
in interface Statement
SQLException
public ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
in interface Statement
SQLException
- if this object is closedpublic boolean getMoreResults(int current) throws SQLException
getMoreResults
in interface Statement
current
- Statement.CLOSE_CURRENT_RESULT,
Statement.KEEP_CURRENT_RESULT,
or Statement.CLOSE_ALL_RESULTSSQLException
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- the SQL statementcolumnNames
- ignoredSQLException
- if a database error occurred or a
select statement was executedpublic int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
protected boolean checkClosed(boolean write)
write
- if the next operation is possibly writingDbException
- if it is closedprotected void closeOldResultSet() throws SQLException
SQLException
protected void setExecutingStatement(CommandInterface c)
c
- the commandpublic int getLastExecutedCommandType()
public boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
public boolean isPoolable()
isPoolable
in interface Statement
public void setPoolable(boolean poolable)
setPoolable
in interface Statement
poolable
- the requested valueCopyright © 2012 JBoss by Red Hat. All Rights Reserved.