java.lang.Object
org.jooq.tools.jdbc.JDBC41Connection
org.jooq.tools.jdbc.DefaultConnection
org.jooq.tools.jdbc.BatchedConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
A batching connection.
This connection buffers consecutive identical prepared statements for
DELETE
, INSERT
, MERGE
,
UPDATE
statements, instead of allowing for them to be executed
directly.
Calls to PreparedStatement.executeUpdate()
or
PreparedStatement.execute()
are replaced by
PreparedStatement.addBatch()
. The update count of such operations is
always zero, and cannot be retrieved later on. When any of the following
events happen, the batch is executed using Statement.executeBatch()
:
- The
close()
method is called (the call is not delegated to the wrapped connection). - A
Connection.prepareStatement(String)
call is made with a different SQL string. - Any other type of statement is created or other API is called, such as
commit()
.
- Author:
- Lukas Eder
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorDescriptionBatchedConnection
(Connection delegate) BatchedConnection
(Connection delegate, int batchSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
void
commit()
createStatement
(int resultSetType, int resultSetConcurrency) createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) boolean
getClientInfo
(String name) int
int
boolean
boolean
isValid
(int timeout) boolean
isWrapperFor
(Class<?> iface) prepareCall
(String sql) prepareCall
(String sql, int resultSetType, int resultSetConcurrency) prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql) prepareStatement
(String sql, int autoGeneratedKeys) prepareStatement
(String sql, int[] columnIndexes) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql, String[] columnNames) void
releaseSavepoint
(Savepoint savepoint) void
rollback()
void
void
setAutoCommit
(boolean autoCommit) void
setCatalog
(String catalog) void
setClientInfo
(String name, String value) void
setClientInfo
(Properties properties) void
setHoldability
(int holdability) void
setReadOnly
(boolean readOnly) setSavepoint
(String name) void
setTransactionIsolation
(int level) void
setTypeMap
(Map<String, Class<?>> map) <T> T
Methods inherited from class org.jooq.tools.jdbc.DefaultConnection
abort, beginRequest, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, endRequest, getDelegate, getMetaData, getNetworkTimeout, getSchema, isClosed, nativeSQL, setNetworkTimeout, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Constructor Details
-
BatchedConnection
-
BatchedConnection
-
-
Method Details
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Overrides:
unwrap
in classDefaultConnection
- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Overrides:
isWrapperFor
in classDefaultConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in classDefaultConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in classDefaultConnection
- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classDefaultConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classDefaultConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classDefaultConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classDefaultConnection
- Throws:
SQLException
-
commit
- Specified by:
commit
in interfaceConnection
- Overrides:
commit
in classDefaultConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Overrides:
rollback
in classDefaultConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Overrides:
rollback
in classDefaultConnection
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classDefaultConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Overrides:
setSavepoint
in classDefaultConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Overrides:
setSavepoint
in classDefaultConnection
- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepoint
in interfaceConnection
- Overrides:
releaseSavepoint
in classDefaultConnection
- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Overrides:
setAutoCommit
in classDefaultConnection
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Overrides:
getAutoCommit
in classDefaultConnection
- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnly
in interfaceConnection
- Overrides:
setReadOnly
in classDefaultConnection
- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnly
in interfaceConnection
- Overrides:
isReadOnly
in classDefaultConnection
- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalog
in interfaceConnection
- Overrides:
setCatalog
in classDefaultConnection
- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalog
in interfaceConnection
- Overrides:
getCatalog
in classDefaultConnection
- Throws:
SQLException
-
getWarnings
- Specified by:
getWarnings
in interfaceConnection
- Overrides:
getWarnings
in classDefaultConnection
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceConnection
- Overrides:
clearWarnings
in classDefaultConnection
- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolation
in interfaceConnection
- Overrides:
setTransactionIsolation
in classDefaultConnection
- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolation
in interfaceConnection
- Overrides:
getTransactionIsolation
in classDefaultConnection
- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMap
in interfaceConnection
- Overrides:
setTypeMap
in classDefaultConnection
- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMap
in interfaceConnection
- Overrides:
getTypeMap
in classDefaultConnection
- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldability
in interfaceConnection
- Overrides:
setHoldability
in classDefaultConnection
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldability
in interfaceConnection
- Overrides:
getHoldability
in classDefaultConnection
- Throws:
SQLException
-
isValid
- Specified by:
isValid
in interfaceConnection
- Overrides:
isValid
in classDefaultConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Overrides:
setClientInfo
in classDefaultConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Overrides:
setClientInfo
in classDefaultConnection
- Throws:
SQLClientInfoException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Overrides:
getClientInfo
in classDefaultConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Overrides:
getClientInfo
in classDefaultConnection
- Throws:
SQLException
-