Class PostgreSQLRDBMSActionStrategy

java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.strategy.BaseRDBMSActionStrategy
com.kingsrook.qqq.backend.module.postgres.strategy.PostgreSQLRDBMSActionStrategy
All Implemented Interfaces:
RDBMSActionStrategyInterface

public class PostgreSQLRDBMSActionStrategy extends BaseRDBMSActionStrategy
PostgreSQL specialization of the default RDBMS/JDBC action strategy. This class provides PostgreSQL-specific implementations for database operations, including optimized insert operations using RETURNING clause, proper handling of temporal data types, and PostgreSQL-specific parameter binding behavior.
  • Constructor Details

    • PostgreSQLRDBMSActionStrategy

      public PostgreSQLRDBMSActionStrategy()
  • Method Details

    • executeInsertForGeneratedIds

      public List<Serializable> executeInsertForGeneratedIds(Connection connection, String sql, List<Object> params, QFieldMetaData primaryKeyField) throws SQLException
      PostgreSQL uses RETURNING clause for getting generated IDs. This is more efficient than the default JDBC approach.
      Specified by:
      executeInsertForGeneratedIds in interface RDBMSActionStrategyInterface
      Overrides:
      executeInsertForGeneratedIds in class BaseRDBMSActionStrategy
      Parameters:
      connection - the database connection
      sql - the INSERT SQL statement
      params - the query parameters
      primaryKeyField - the primary key field metadata
      Returns:
      list of generated IDs
      Throws:
      SQLException - if a database error occurs
    • bindParamObject

      protected int bindParamObject(PreparedStatement statement, int index, Object value) throws SQLException
      Override parameter binding for PostgreSQL-specific handling. PostgreSQL JDBC driver requires explicit handling of temporal types. For null values, PostgreSQL needs Types.OTHER (not Types.CHAR) so it can infer the correct type from the column definition.
      Overrides:
      bindParamObject in class BaseRDBMSActionStrategy
      Parameters:
      statement - the prepared statement
      index - the parameter index
      value - the parameter value
      Returns:
      the number of parameters bound (always 1)
      Throws:
      SQLException - if a database error occurs
    • getIdentifierQuoteString

      public String getIdentifierQuoteString()
      PostgreSQL doesn't require identifier quoting for standard identifiers. Return empty string to not quote identifiers.
      Returns:
      empty string (no quoting)