Class PStmtKey
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.PStmtKey
-
- Direct Known Subclasses:
PStmtKeyCPDS
public class PStmtKey extends java.lang.Object
A key uniquely identifyingPreparedStatement
s.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
PStmtKey.PreparedCallSQL
Builder for prepareCall(String sql).private class
PStmtKey.PreparedCallWithResultSetConcurrency
Builder for prepareCall(String sql, int resultSetType, int resultSetConcurrency).private class
PStmtKey.PreparedCallWithResultSetHoldability
Builder for prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability).private class
PStmtKey.PreparedStatementSQL
Builder for prepareStatement(String sql).private class
PStmtKey.PreparedStatementWithAutoGeneratedKeys
Builder for prepareStatement(String sql, int autoGeneratedKeys).private class
PStmtKey.PreparedStatementWithColumnIndexes
Builder for prepareStatement(String sql, int[] columnIndexes).private class
PStmtKey.PreparedStatementWithColumnNames
Builder for prepareStatement(String sql, String[] columnNames).private class
PStmtKey.PreparedStatementWithResultSetConcurrency
Builder for prepareStatement(String sql, int resultSetType, int resultSetConcurrency).private class
PStmtKey.PreparedStatementWithResultSetHoldability
Builder for prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability).private static interface
PStmtKey.StatementBuilder
Interface for Prepared or Callable Statement.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Integer
autoGeneratedKeys
A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.private PStmtKey.StatementBuilder
builder
Statement builderprivate java.lang.String
catalog
Database catalog.private int[]
columnIndexes
An array of column indexes indicating the columns that should be returned from the inserted row or rows.private java.lang.String[]
columnNames
An array of column names indicating the columns that should be returned from the inserted row or rows.private java.lang.Integer
resultSetConcurrency
Result set concurrency.private java.lang.Integer
resultSetHoldability
Result set holdability.private java.lang.Integer
resultSetType
Result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.private java.lang.String
schema
Database schema.private java.lang.String
sql
SQL defining Prepared or Callable Statementprivate PoolingConnection.StatementType
statementType
Statement type, prepared or callable.
-
Constructor Summary
Constructors Constructor Description PStmtKey(java.lang.String sql)
Deprecated.PStmtKey(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, int autoGeneratedKeys)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, int[] columnIndexes)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency)
Deprecated.Use @linkPStmtKey(String, String, String, int, int)
.PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)
PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)
PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String[] columnNames)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int autoGeneratedKeys)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int[] columnIndexes)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, java.lang.String[] columnNames)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, PoolingConnection.StatementType statementType, java.lang.Integer autoGeneratedKeys)
Constructs a key to uniquely identify a prepared statement.PStmtKey(java.lang.String sql, java.lang.String catalog, PoolingConnection.StatementType statementType)
Deprecated.PStmtKey(java.lang.String sql, java.lang.String catalog, PoolingConnection.StatementType statementType, java.lang.Integer autoGeneratedKeys)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.Statement
createStatement(java.sql.Connection connection)
Creates a new Statement from the given Connection.boolean
equals(java.lang.Object obj)
java.lang.Integer
getAutoGeneratedKeys()
Gets a flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.java.lang.String
getCatalog()
The catalog.int[]
getColumnIndexes()
Gets an array of column indexes indicating the columns that should be returned from the inserted row or rows.java.lang.String[]
getColumnNames()
Gets an array of column names indicating the columns that should be returned from the inserted row or rows.java.lang.Integer
getResultSetConcurrency()
Gets the result set concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.java.lang.Integer
getResultSetHoldability()
Gets the result set holdability, one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.java.lang.Integer
getResultSetType()
Gets the result set type, one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.java.lang.String
getSchema()
The schema.java.lang.String
getSql()
Gets the SQL statement.PoolingConnection.StatementType
getStmtType()
The SQL statement type.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
sql
private final java.lang.String sql
SQL defining Prepared or Callable Statement
-
resultSetType
private final java.lang.Integer resultSetType
Result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.
-
resultSetConcurrency
private final java.lang.Integer resultSetConcurrency
Result set concurrency. A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.
-
resultSetHoldability
private final java.lang.Integer resultSetHoldability
Result set holdability. One of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.
-
catalog
private final java.lang.String catalog
Database catalog.
-
schema
private final java.lang.String schema
Database schema.
-
autoGeneratedKeys
private final java.lang.Integer autoGeneratedKeys
A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.
-
columnIndexes
private final int[] columnIndexes
An array of column indexes indicating the columns that should be returned from the inserted row or rows.
-
columnNames
private final java.lang.String[] columnNames
An array of column names indicating the columns that should be returned from the inserted row or rows.
-
statementType
private final PoolingConnection.StatementType statementType
Statement type, prepared or callable.
-
builder
private transient PStmtKey.StatementBuilder builder
Statement builder
-
-
Constructor Detail
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.resultSetType
- A result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int autoGeneratedKeys)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.autoGeneratedKeys
- A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency)
Deprecated.Use @linkPStmtKey(String, String, String, int, int)
.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.resultSetType
- A result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.resultSetType
- a result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- One of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.resultSetType
- a result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.resultSetHoldability
- One of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.statementType
- The SQL statement type, prepared or callable.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.resultSetType
- A result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.statementType
- The SQL statement type, prepared or callable.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, int[] columnIndexes)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.columnIndexes
- An array of column indexes indicating the columns that should be returned from the inserted row or rows.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, PoolingConnection.StatementType statementType)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.statementType
- The SQL statement type, prepared or callable.
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, PoolingConnection.StatementType statementType, java.lang.Integer autoGeneratedKeys)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.statementType
- The SQL statement type, prepared or callable.autoGeneratedKeys
- A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int autoGeneratedKeys)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schemaautoGeneratedKeys
- A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schemaresultSetType
- A result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schemaresultSetType
- a result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- One of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.resultSetType
- a result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.resultSetHoldability
- One of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.statementType
- The SQL statement type, prepared or callable.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.resultSetType
- A result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.resultSetConcurrency
- A concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.statementType
- The SQL statement type, prepared or callable.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, int[] columnIndexes)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.columnIndexes
- An array of column indexes indicating the columns that should be returned from the inserted row or rows.
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, PoolingConnection.StatementType statementType)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.statementType
- The SQL statement type, prepared or callable.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, PoolingConnection.StatementType statementType, java.lang.Integer autoGeneratedKeys)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.statementType
- The SQL statement type, prepared or callable.autoGeneratedKeys
- A flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.- Since:
- 2.5.0
-
PStmtKey
public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String schema, java.lang.String[] columnNames)
Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.schema
- The schema.columnNames
- An array of column names indicating the columns that should be returned from the inserted row or rows.- Since:
- 2.5.0
-
PStmtKey
@Deprecated public PStmtKey(java.lang.String sql, java.lang.String catalog, java.lang.String[] columnNames)
Deprecated.Constructs a key to uniquely identify a prepared statement.- Parameters:
sql
- The SQL statement.catalog
- The catalog.columnNames
- An array of column names indicating the columns that should be returned from the inserted row or rows.
-
-
Method Detail
-
createStatement
public java.sql.Statement createStatement(java.sql.Connection connection) throws java.sql.SQLException
Creates a new Statement from the given Connection.- Parameters:
connection
- The Connection to use to create the statement.- Returns:
- The statement.
- Throws:
java.sql.SQLException
- Thrown when there is a problem creating the statement.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getAutoGeneratedKeys
public java.lang.Integer getAutoGeneratedKeys()
Gets a flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
.- Returns:
- a flag indicating whether auto-generated keys should be returned.
-
getCatalog
public java.lang.String getCatalog()
The catalog.- Returns:
- The catalog.
-
getColumnIndexes
public int[] getColumnIndexes()
Gets an array of column indexes indicating the columns that should be returned from the inserted row or rows.- Returns:
- An array of column indexes.
-
getColumnNames
public java.lang.String[] getColumnNames()
Gets an array of column names indicating the columns that should be returned from the inserted row or rows.- Returns:
- An array of column names.
-
getResultSetConcurrency
public java.lang.Integer getResultSetConcurrency()
Gets the result set concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
.- Returns:
- The result set concurrency type.
-
getResultSetHoldability
public java.lang.Integer getResultSetHoldability()
Gets the result set holdability, one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
.- Returns:
- The result set holdability.
-
getResultSetType
public java.lang.Integer getResultSetType()
Gets the result set type, one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.- Returns:
- the result set type.
-
getSchema
public java.lang.String getSchema()
The schema.- Returns:
- The catalog.
-
getSql
public java.lang.String getSql()
Gets the SQL statement.- Returns:
- the SQL statement.
-
getStmtType
public PoolingConnection.StatementType getStmtType()
The SQL statement type.- Returns:
- The SQL statement type.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-