Class StatementKeyFactory


  • public final class StatementKeyFactory
    extends java.lang.Object
    A factory for creating JDBC statement keys for use with the JDBC statement cache.
    See Also:
    JDBCStatementCache
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean CALLABLE  
      private static boolean PREPARED  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StatementKeyFactory()
      Instantiation not allowed.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static StatementKey newCallable​(java.lang.String sql, java.lang.String schema, int holdability)
      Creates a key for a callable statement.
      static StatementKey newCallable​(java.lang.String sql, java.lang.String schema, int rst, int rsc, int rsh)
      Creates a key for a callable statement specifying result set type and concurrency.
      static StatementKey newPrepared​(java.lang.String sql, java.lang.String schema, int holdability)
      Creates a key for a query with default settings.
      static StatementKey newPrepared​(java.lang.String sql, java.lang.String schema, int holdability, int autogeneratedKeys)
      Creates a key for a query specifying whether auto-generated keys shall be returned.
      static StatementKey newPrepared​(java.lang.String sql, java.lang.String schema, int rst, int rsc, int rsh)
      Creates a key for a query specifying result set type and concurrency.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StatementKeyFactory

        private StatementKeyFactory()
        Instantiation not allowed.
    • Method Detail

      • newPrepared

        public static StatementKey newPrepared​(java.lang.String sql,
                                               java.lang.String schema,
                                               int holdability)
        Creates a key for a query with default settings.

        Defaults are according to the JDBC standard; result set type will be ResultSet.TYPE_FORWARD_ONLY, concurrency will be ResultSet.CONCUR_READ_ONLY and the statement will not return auto-generated keys.

        Parameters:
        sql - SQL query string
        schema - current compilation schema
        holdability - result set holdability
        Returns:
        A statement key.
      • newPrepared

        public static StatementKey newPrepared​(java.lang.String sql,
                                               java.lang.String schema,
                                               int holdability,
                                               int autogeneratedKeys)
        Creates a key for a query specifying whether auto-generated keys shall be returned.

        Unspecified settings will be according to the JDBC standard; result set type will be ResultSet.TYPE_FORWARD_ONLY, concurrency will be ResultSet.CONCUR_READ_ONLY.

        Parameters:
        sql - SQL query string
        schema - current compilation schema
        holdability - result set holdability
        autogeneratedKeys - tells whether or not to reutrn auto-generated keys
        Returns:
        A statement key.
      • newPrepared

        public static StatementKey newPrepared​(java.lang.String sql,
                                               java.lang.String schema,
                                               int rst,
                                               int rsc,
                                               int rsh)
        Creates a key for a query specifying result set type and concurrency.

        The returned key is for a statement not returning auto-generated keys.

        Parameters:
        sql - SQL query string
        schema - current compilation schema
        rst - result set type
        rsc - result set concurrency level
        rsh - result set holdability
        Returns:
        A statement key.
      • newCallable

        public static StatementKey newCallable​(java.lang.String sql,
                                               java.lang.String schema,
                                               int holdability)
        Creates a key for a callable statement.

        Unspecified settings will be according to the JDBC standard; result set type will be ResultSet.TYPE_FORWARD_ONLY, concurrency will be ResultSet.CONCUR_READ_ONLY.

        Parameters:
        sql - SQL query string
        schema - current compilation schema
        holdability - result set holdability
        Returns:
        A statement key.
      • newCallable

        public static StatementKey newCallable​(java.lang.String sql,
                                               java.lang.String schema,
                                               int rst,
                                               int rsc,
                                               int rsh)
        Creates a key for a callable statement specifying result set type and concurrency.

        The returned key is for a statement not returning auto-generated keys.

        Parameters:
        sql - SQL query string
        schema - current compilation schema
        rst - result set type
        rsc - result set concurrency level
        rsh - result set holdability
        Returns:
        A statement key.