org.apache.commons.dbcp2

## Class PStmtKey

- java.lang.Object
- - org.apache.commons.dbcp2.PStmtKey

- Direct Known Subclasses:
    PStmtKeyCPDS

      public class PStmtKey
      extends Object

  A key uniquely identifying `PreparedStatement`s.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PStmtKey(String sql)` Deprecated. Use `PStmtKey(String, String, String)`.
    `PStmtKey(String sql, int resultSetType, int resultSetConcurrency)` Deprecated. Use `PStmtKey(String, String, String, int, int)`.
    `PStmtKey(String sql, String catalog)` Deprecated. Use `PStmtKey(String, String, String)`.
    `PStmtKey(String sql, String catalog, int autoGeneratedKeys)` Deprecated. Use `PStmtKey(String, String, String, int)`.
    `PStmtKey(String sql, String catalog, int[] columnIndexes)` Deprecated. Use `PStmtKey(String, String, String, int[])`.
    `PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency)` Deprecated. Use @link `PStmtKey(String, String, String, int, int)`.
    `PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability)` Deprecated. Use `PStmtKey(String, String, String, int, int, int)`.
    `PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)` Deprecated. Use `PStmtKey(String, String, String, int, int, int, PoolingConnection.StatementType)`
    `PStmtKey(String sql, String catalog, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)` Deprecated. Use `PStmtKey(String, String, String, int, int, PoolingConnection.StatementType)`.
    `PStmtKey(String sql, String catalog, PoolingConnection.StatementType statementType)` Deprecated. Use `PStmtKey(String, String, String, PoolingConnection.StatementType)`.
    `PStmtKey(String sql, String catalog, PoolingConnection.StatementType statementType, Integer autoGeneratedKeys)` Deprecated. Use `PStmtKey(String, String, String, PoolingConnection.StatementType, Integer)`
    `PStmtKey(String sql, String catalog, String schema)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String[] columnNames)` Deprecated. Use `PStmtKey(String, String, String, String[])`.
    `PStmtKey(String sql, String catalog, String schema, int autoGeneratedKeys)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, int[] columnIndexes)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, int resultSetType, int resultSetConcurrency)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, int resultSetType, int resultSetConcurrency, int resultSetHoldability, PoolingConnection.StatementType statementType)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, int resultSetType, int resultSetConcurrency, PoolingConnection.StatementType statementType)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, PoolingConnection.StatementType statementType)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, PoolingConnection.StatementType statementType, Integer autoGeneratedKeys)` Constructs a key to uniquely identify a prepared statement.
    `PStmtKey(String sql, String catalog, String schema, String[] columnNames)` Constructs a key to uniquely identify a prepared statement.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Statement` | `createStatement(Connection connection)` Creates a new Statement from the given Connection.
    `boolean` | `equals(Object obj)`
    `Integer` | `getAutoGeneratedKeys()` Gets a flag indicating whether auto-generated keys should be returned; one of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`.
    `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.
    `String[]` | `getColumnNames()` Gets an array of column names indicating the columns that should be returned from the inserted row or rows.
    `Integer` | `getResultSetConcurrency()` Gets the result set concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
    `Integer` | `getResultSetHoldability()` Gets the result set holdability, one of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.
    `Integer` | `getResultSetType()` Gets the result set type, one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
    `String` | `getSchema()` The schema.
    `String` | `getSql()` Gets the SQL statement.
    `PoolingConnection.StatementType` | `getStmtType()` The SQL statement type.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql)

      Deprecated. Use `PStmtKey(String, String, String)`.
      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       int resultSetType,
                                       int resultSetConcurrency)

      Deprecated. Use `PStmtKey(String, String, String, int, int)`.
      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.
        `resultSetType` - A result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog)

      Deprecated. Use `PStmtKey(String, String, String)`.
      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.
        `catalog` - The catalog.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int autoGeneratedKeys)

      Deprecated. Use `PStmtKey(String, String, String, int)`.
      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 of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int resultSetType,
                                       int resultSetConcurrency)

      Deprecated. Use @link `PStmtKey(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 of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int resultSetType,
                                       int resultSetConcurrency,
                                       int resultSetHoldability)

      Deprecated. Use `PStmtKey(String, String, String, int, 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 of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
        `resultSetHoldability` - One of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int resultSetType,
                                       int resultSetConcurrency,
                                       int resultSetHoldability,
                                       PoolingConnection.StatementType statementType)

      Deprecated. Use `PStmtKey(String, String, String, int, int, int, PoolingConnection.StatementType)`
      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.
        `catalog` - The catalog.
        `resultSetType` - a result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
        `resultSetHoldability` - One of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.
        `statementType` - The SQL statement type, prepared or callable.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int resultSetType,
                                       int resultSetConcurrency,
                                       PoolingConnection.StatementType statementType)

      Deprecated. Use `PStmtKey(String, String, String, int, int, PoolingConnection.StatementType)`.
      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.
        `catalog` - The catalog.
        `resultSetType` - A result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
        `statementType` - The SQL statement type, prepared or callable.

    - #### PStmtKey

          @Deprecated
          public PStmtKey(String sql,
                                       String catalog,
                                       int[] columnIndexes)

      Deprecated. Use `PStmtKey(String, String, String, int[])`.
      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(String sql,
                                       String catalog,
                                       PoolingConnection.StatementType statementType)

      Deprecated. Use `PStmtKey(String, String, String, PoolingConnection.StatementType)`.
      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(String sql,
                                       String catalog,
                                       PoolingConnection.StatementType statementType,
                                       Integer autoGeneratedKeys)

      Deprecated. Use `PStmtKey(String, String, String, PoolingConnection.StatementType, Integer)`
      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 of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`.

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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(String sql,
                          String catalog,
                          String schema,
                          int autoGeneratedKeys)

      Constructs a key to uniquely identify a prepared statement.
      Parameters:
        `sql` - The SQL statement.
        `catalog` - The catalog.
        `schema` - The schema
        `autoGeneratedKeys` - A flag indicating whether auto-generated keys should be returned; one of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`.
      Since:
        2.5.0

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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 schema
        `resultSetType` - A result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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 schema
        `resultSetType` - a result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
        `resultSetHoldability` - One of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.
      Since:
        2.5.0

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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 of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
        `resultSetHoldability` - One of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.
        `statementType` - The SQL statement type, prepared or callable.
      Since:
        2.5.0

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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 of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
        `resultSetConcurrency` - A concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
        `statementType` - The SQL statement type, prepared or callable.
      Since:
        2.5.0

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          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(String sql,
                          String catalog,
                          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(String sql,
                          String catalog,
                          String schema,
                          PoolingConnection.StatementType statementType,
                          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 of `Statement.RETURN_GENERATED_KEYS` or `Statement.NO_GENERATED_KEYS`.
      Since:
        2.5.0

    - #### PStmtKey

          public PStmtKey(String sql,
                          String catalog,
                          String schema,
                          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(String sql,
                                       String catalog,
                                       String[] columnNames)

      Deprecated. Use `PStmtKey(String, String, String, String[])`.
      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 Statement createStatement(Connection connection)
                                    throws SQLException

      Creates a new Statement from the given Connection.
      Parameters:
        `connection` - The Connection to use to create the statement.
      Returns:
        The statement.
      Throws:
        `SQLException` - Thrown when there is a problem creating the statement.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### getAutoGeneratedKeys

          public Integer getAutoGeneratedKeys()

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

    - #### getCatalog

          public 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 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 Integer getResultSetConcurrency()

      Gets the result set concurrency type; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`.
      Returns:
        The result set concurrency type.

    - #### getResultSetHoldability

          public Integer getResultSetHoldability()

      Gets the result set holdability, one of the following `ResultSet` constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`.
      Returns:
        The result set holdability.

    - #### getResultSetType

          public Integer getResultSetType()

      Gets the result set type, one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`.
      Returns:
        the result set type.

    - #### getSchema

          public String getSchema()

      The schema.
      Returns:
        The catalog.

    - #### getSql

          public 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 class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.