Package org.jboss.jca.adapters.jdbc
Class WrappedStatement
java.lang.Object
org.jboss.jca.adapters.jdbc.JBossWrapper
org.jboss.jca.adapters.jdbc.WrappedStatement
- All Implemented Interfaces:
Serializable,AutoCloseable,Statement,Wrapper,StatementAccess
- Direct Known Subclasses:
WrappedPreparedStatement,WrappedStatementJDK7,WrappedStatementJDK8
A wrapper for a statement.
- Author:
- David Jencks, Adrian Brock, Jesper Pedersen
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static IntegerDefault fetch sizeprotected final booleanDo lockingprotected final StringThe jndi nameprotected final booleanSpy functionalityprotected static org.jboss.logging.LoggerThe spy loggerprotected final StringThe spy logging categoryFields inherited from class org.jboss.jca.adapters.jdbc.JBossWrapper
bundleFields 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
ConstructorsModifierConstructorDescriptionWrappedStatement(WrappedConnection lc, Statement s, boolean spy, String jndiName, boolean doLocking) ConstructorprotectedWrappedStatement(WrappedConnection lc, Statement s, boolean spy, String jndiName, boolean doLocking, String spyLoggingCategory) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcancel()protected voidCheck configured query timeoutprotected SQLExceptionCheck exceptionprotected voidCheck stateprotected voidCheck transactionprotected voidCheck if transaction is activevoidvoidvoidclose()voidprotected voidClose result setsbooleanbooleanbooleanbooleanint[]executeQuery(String sql) intexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) intintintintbooleanbooleangetMoreResults(int current) intintintintGet the underlying statementintprotected StatementGet the wrapped statementprotected voidClosebooleanisClosed()booleanbooleanprotected voidlock()Lock connectionprotected ResultSetregisterResultSet(ResultSet resultSet) Register a result setvoidsetCursorName(String name) voidsetEscapeProcessing(boolean enable) voidsetFetchDirection(int direction) voidsetFetchSize(int rows) voidsetMaxFieldSize(int max) voidsetMaxRows(int max) voidsetPoolable(boolean poolable) voidsetQueryTimeout(int timeout) protected voidunlock()Unlock connectionprotected voidunregisterResultSet(WrappedResultSet resultSet) Unregister a result setprotected abstract WrappedResultSetwrapResultSet(ResultSet resultSet, boolean spy, String jndiName, boolean doLocking) Wrap the result setMethods inherited from class org.jboss.jca.adapters.jdbc.JBossWrapper
isWrapperFor, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isSimpleIdentifier, setLargeMaxRowsMethods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
spyLogger
protected static org.jboss.logging.Logger spyLoggerThe spy logger -
spy
protected final boolean spySpy functionality -
jndiName
The jndi name -
spyLoggingCategory
The spy logging category -
defaultFetchSize
Default fetch size -
doLocking
protected final boolean doLockingDo locking
-
-
Constructor Details
-
WrappedStatement
public WrappedStatement(WrappedConnection lc, Statement s, boolean spy, String jndiName, boolean doLocking) Constructor- Parameters:
lc- The connections- The statementspy- The spy valuejndiName- The jndi namedoLocking- Do locking
-
WrappedStatement
protected WrappedStatement(WrappedConnection lc, Statement s, boolean spy, String jndiName, boolean doLocking, String spyLoggingCategory) Constructor- Parameters:
lc- The connections- The statementspy- The spy valuejndiName- The jndi namedoLocking- Do lockingspyLoggingCategory- The spy logging category
-
-
Method Details
-
lock
Lock connection- Throws:
SQLException- Thrown if an error occurs
-
unlock
protected void unlock()Unlock connection -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceStatement- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
executeQuery
- Specified by:
executeQueryin interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
getMaxFieldSize
- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
getMaxRows
- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
- Specified by:
getQueryTimeoutin interfaceStatement- Throws:
SQLException
-
setQueryTimeout
- Specified by:
setQueryTimeoutin interfaceStatement- Throws:
SQLException
-
cancel
- Specified by:
cancelin interfaceStatement- Throws:
SQLException
-
setCursorName
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
setFetchDirection
- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
setFetchSize
- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getFetchSize
- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
executeBatch
- Specified by:
executeBatchin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
isPoolable
- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
setPoolable
- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
closeOnCompletion
- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
getUnderlyingStatement
Get the underlying statement- Specified by:
getUnderlyingStatementin interfaceStatementAccess- Returns:
- the underlying statement
- Throws:
SQLException- when already closed
-
getWrappedObject
Get the wrapped statement- Overrides:
getWrappedObjectin classJBossWrapper- Returns:
- The result
- Throws:
SQLException- Thrown if an error occurs
-
checkException
Check exception- Parameters:
t- The throwable- Returns:
- The result
- Throws:
SQLException- Thrown if an error occurs
-
checkTransaction
Check transaction- Throws:
SQLException- Thrown if an error occurs
-
checkConfiguredQueryTimeout
Check configured query timeout- Throws:
SQLException- Thrown if an error occurs
-
checkTransactionActive
Check if transaction is active- Throws:
SQLException- Thrown if an error occurs
-
internalClose
Close- Throws:
SQLException- Thrown if an error occurs
-
checkState
Check state- Throws:
SQLException- Thrown if an error occurs
-
wrapResultSet
protected abstract WrappedResultSet wrapResultSet(ResultSet resultSet, boolean spy, String jndiName, boolean doLocking) Wrap the result set- Parameters:
resultSet- The result setspy- The spy valuejndiName- The jndi namedoLocking- Do locking- Returns:
- The result
-
registerResultSet
Register a result set- Parameters:
resultSet- The result set- Returns:
- The result
-
unregisterResultSet
Unregister a result set- Parameters:
resultSet- The result set
-
closeResultSets
protected void closeResultSets()Close result sets
-