Module io.helidon.integrations.jdbc
Package io.helidon.integrations.jdbc
Class DelegatingStatement<S extends Statement>
java.lang.Object
io.helidon.integrations.jdbc.DelegatingStatement<S>
- Type Parameters:
S- the type of theStatementsubclass
- All Implemented Interfaces:
AutoCloseable,Statement,Wrapper
- Direct Known Subclasses:
DelegatingPreparedStatement
-
Field Summary
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
ConstructorsConstructorDescriptionDelegatingStatement(Connection connection, S delegate, boolean closeable, boolean strictClosedChecking) Creates a newDelegatingStatement. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcancel()protected final voidEnsures thisDelegatingStatementis not closed, if strict closed checking was enabled at construction time.voidvoidvoidclose()Overrides theStatement.close()method so that when it is invoked thisDelegatingStatementis closed only if it is closeable.voidprotected final Sdelegate()Returns theStatementto which all operations will be delegated.enquoteIdentifier(String identifier, boolean alwaysQuote) enquoteLiteral(String val) booleanbooleanbooleanbooleanint[]long[]longexecuteLargeUpdate(String sql) longexecuteLargeUpdate(String sql, int autoGeneratedKeys) longexecuteLargeUpdate(String sql, int[] columnIndexes) longexecuteLargeUpdate(String sql, String[] columnNames) executeQuery(String sql) intexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) Returns theConnectionsupplied at construction time.intintlonglongintintbooleanbooleangetMoreResults(int current) intintintintintbooleanbooleanisClosed()booleanbooleanbooleanisSimpleIdentifier(String identifier) booleanisWrapperFor(Class<?> iface) voidsetCloseable(boolean closeable) Sets the closeable status of thisDelegatingStatement.voidsetCursorName(String name) voidsetEscapeProcessing(boolean enable) voidsetFetchDirection(int direction) voidsetFetchSize(int rows) voidsetLargeMaxRows(long max) voidsetMaxFieldSize(int max) voidsetMaxRows(int max) voidsetPoolable(boolean poolable) voidsetQueryTimeout(int seconds) <T> T
-
Constructor Details
-
DelegatingStatement
public DelegatingStatement(Connection connection, S delegate, boolean closeable, boolean strictClosedChecking) Creates a newDelegatingStatement.- Parameters:
connection- theConnectionthat created thisDelegatingStatement; must not benulldelegate- theStatementinstance to which all operations will be delegated; must not benullcloseable- the initial value for thisDelegatingStatement's closeable statusstrictClosedChecking- iftrue, then thisDelegatingStatement'sisClosed()method will be invoked before every operation that cannot take place on a closed statement, and, if it returnstrue, the operation in question will fail with aSQLException- Throws:
NullPointerException- if eitherconnectionordelegateisnull- See Also:
-
-
Method Details
-
delegate
Returns theStatementto which all operations will be delegated.This method never returns
null.- Returns:
- the
Statementto which all operations will be delegated; nevernull
-
isCloseable
Returnstrueif a call toclose()will actually close thisDelegatingStatement.This method returns
truewhensetCloseable(boolean)has been called with a value oftrueand theisClosed()method returnsfalse.- Returns:
trueif a call toclose()will actually close thisDelegatingStatement;falsein all other cases- Throws:
SQLException- ifisClosed()throws aSQLException- See Also:
-
setCloseable
public void setCloseable(boolean closeable) Sets the closeable status of thisDelegatingStatement.Note that calling this method with a value of
truedoes not necessarily mean that theisCloseable()method will subsequently returntrue, since theisClosed()method may returntrue.- Parameters:
closeable- whether or not a call toclose()will actually close thisDelegatingStatement- See Also:
-
isClosed
- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
close
Overrides theStatement.close()method so that when it is invoked thisDelegatingStatementis closed only if it is closeable.Overrides should normally call
super.close()as part of their implementation.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException- if an error occurs- See Also:
-
executeQuery
- Specified by:
executeQueryin 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
-
getWarnings
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
setCursorName
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
- Specified by:
getUpdateCountin 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
-
getConnection
Returns theConnectionsupplied at construction time.- Specified by:
getConnectionin interfaceStatement- Returns:
- the
Connectionsupplied at construction time; nevernull - Throws:
SQLException- not thrown by the default implementation of this method- See Also:
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
setPoolable
- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isPoolable
- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
closeOnCompletion
- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
getLargeUpdateCount
- Specified by:
getLargeUpdateCountin interfaceStatement- Throws:
SQLException
-
setLargeMaxRows
- Specified by:
setLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
getLargeMaxRows
- Specified by:
getLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
executeLargeBatch
- Specified by:
executeLargeBatchin interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
enquoteLiteral
- Specified by:
enquoteLiteralin interfaceStatement- Throws:
SQLException
-
enquoteIdentifier
- Specified by:
enquoteIdentifierin interfaceStatement- Throws:
SQLException
-
isSimpleIdentifier
- Specified by:
isSimpleIdentifierin interfaceStatement- Throws:
SQLException
-
enquoteNCharLiteral
- Specified by:
enquoteNCharLiteralin interfaceStatement- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
checkOpen
Ensures thisDelegatingStatementis not closed, if strict closed checking was enabled at construction time.If a subclass overrides the
isClosed()method, the override must not call this method or undefined behavior, such as an infinite loop, may result.This method is intended for advanced use cases only and almost all users of this class will have no reason to call it.
- Throws:
SQLException- if thisDelegatingStatementwas created with strict closed checking enabled and an invocation of theisClosed()method returnstrue, or if some other database access error occurs
-