Top Description Fields Constructors Methods
org.jooq.impl

pack-priv final Class SettingsEnabledConnection

extends DefaultConnection
Class Inheritance
Static Imports
java.lang.Boolean.TRUE, org.jooq.conf.SettingsTools.executePreparedStatements, org.jooq.impl.Tools.BooleanDataKey.DATA_FORCE_STATIC_STATEMENT

Deprecated

as a consequence of DefaultConnection being deprecated. See corresponding docs for further information.

A proxy for a JDBC Connection that handles creation of prepared statements according to the settings' StatementType
Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private final ExecuteContext
private final Settings

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private final boolean
public final PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object for sending parameterized SQL statements to the database.
public final PreparedStatement
prepareStatement(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
public final PreparedStatement
prepareStatement(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.
public final PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int
a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.
public final PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int[]
an array of column indexes indicating the columns that should be returned from the inserted row or rows
columnIndexes
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
public final PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
String[]
an array of column names indicating the columns that should be returned from the inserted row or rows
columnNames
)

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
Inherited from org.jooq.tools.jdbc.DefaultConnection:
abortbeginRequestclearWarningsclosecommitcreateArrayOfcreateBlobcreateClobcreateNClobcreateSQLXMLcreateStatementcreateStatementcreateStatementcreateStructendRequestgetAutoCommitgetCataloggetClientInfogetClientInfogetDelegategetHoldabilitygetMetaDatagetNetworkTimeoutgetSchemagetTransactionIsolationgetTypeMapgetWarningsisClosedisReadOnlyisValidisWrapperFornativeSQLprepareCallprepareCallprepareCallreleaseSavepointrollbackrollbacksetAutoCommitsetCatalogsetClientInfosetClientInfosetHoldabilitysetNetworkTimeoutsetReadOnlysetSavepointsetSavepointsetSchemasetShardingKeysetShardingKeysetShardingKeyIfValidsetShardingKeyIfValidsetTransactionIsolationsetTypeMapunwrap

Field Detail

ctxback to summary
private final ExecuteContext ctx
settingsback to summary
private final Settings settings

Constructor Detail

SettingsEnabledConnectionback to summary
pack-priv SettingsEnabledConnection(Connection delegate, Settings settings, ExecuteContext ctx)

Method Detail

executePreparedStatements0back to summary
private final boolean executePreparedStatements0()
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a PreparedStatement object for sending parameterized SQL statements to the database.

A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note

This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLException objects.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability.

Parameters
sql:String

an SQL statement that may contain one or more '?' IN parameter placeholders

Returns:PreparedStatement

a new default PreparedStatement object containing the pre-compiled SQL statement

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs or this method is called on a closed connection
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareStatement method above, but it allows the default result set type and concurrency to be overridden. The holdability of the created result sets can be determined by calling getHoldability.

Parameters
sql:String

a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters

resultSetType:int

a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE

resultSetConcurrency:int

a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE

Returns:PreparedStatement

a new PreparedStatement object containing the pre-compiled SQL statement that will produce ResultSet objects with the given type and concurrency

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs, this method is called on a closed connection or the given parameters are not ResultSet constants indicating type and concurrency
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

This method is the same as the prepareStatement method above, but it allows the default result set type, concurrency, and holdability to be overridden.

Parameters
sql:String

a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters

resultSetType:int

one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE

resultSetConcurrency:int

one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE

resultSetHoldability:int

one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT

Returns:PreparedStatement

a new PreparedStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs, this method is called on a closed connection or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).

Note

This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability.

Parameters
sql:String

an SQL statement that may contain one or more '?' IN parameter placeholders

autoGeneratedKeys:int

a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS

Returns:PreparedStatement

a new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs, this method is called on a closed connection or the given parameter is not a Statement constant indicating whether auto-generated keys should be returned
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note

This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability.

Parameters
sql:String

an SQL statement that may contain one or more '?' IN parameter placeholders

columnIndexes:int[]

an array of column indexes indicating the columns that should be returned from the inserted row or rows

Returns:PreparedStatement

a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs or this method is called on a closed connection
prepareStatementback to summary
public final PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException

Overrides org.jooq.tools.jdbc.DefaultConnection.prepareStatement.

Implements java.sql.Connection.prepareStatement.

Doc from java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note

This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability.

Parameters
sql:String

an SQL statement that may contain one or more '?' IN parameter placeholders

columnNames:String[]

an array of column names indicating the columns that should be returned from the inserted row or rows

Returns:PreparedStatement

a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names

Annotations
@Override
Exceptions
SQLException:
if a database access error occurs or this method is called on a closed connection