Class PostgresAdapter

java.lang.Object
org.apache.torque.adapter.AbstractAdapter
org.apache.torque.adapter.PostgresAdapter
All Implemented Interfaces:
Serializable, Adapter

public class PostgresAdapter extends AbstractAdapter
This is used to connect to PostgresQL databases. http://www.postgresql.org/
Version:
$Id: PostgresAdapter.java 1848527 2018-12-09 16:27:22Z tv $
Author:
Hakan Tandogan, Henning P. Schmiedehausen
See Also:
  • Constructor Details

    • PostgresAdapter

      protected PostgresAdapter()
      Empty constructor.
  • Method Details

    • toUpperCase

      public String toUpperCase(String in)
      This method is used to ignore case.
      Specified by:
      toUpperCase in interface Adapter
      Specified by:
      toUpperCase in class AbstractAdapter
      Parameters:
      in - The string to transform to upper case.
      Returns:
      The upper case string.
    • ignoreCase

      public String ignoreCase(String in)
      This method is used to ignore case.
      Specified by:
      ignoreCase in interface Adapter
      Specified by:
      ignoreCase in class AbstractAdapter
      Parameters:
      in - The string whose case to ignore.
      Returns:
      The string in a case that can be ignored.
    • getIDMethodType

      public IDMethod getIDMethodType()
      Description copied from class: AbstractAdapter
      Returns the constant from the IDMethod interface denoting which type of primary key generation method this type of RDBMS uses.
      Specified by:
      getIDMethodType in interface Adapter
      Specified by:
      getIDMethodType in class AbstractAdapter
      Returns:
      IDMethod constant
      See Also:
    • getIDMethodSQL

      public String getIDMethodSQL(Object name)
      Description copied from class: AbstractAdapter
      Returns SQL used to get the most recently inserted primary key. Databases which have no support for this return null.
      Specified by:
      getIDMethodSQL in interface Adapter
      Specified by:
      getIDMethodSQL in class AbstractAdapter
      Parameters:
      name - The name of the field (should be of type String).
      Returns:
      SQL to retreive the next database key.
      See Also:
    • lockTable

      public void lockTable(Connection con, String table) throws SQLException
      Locks the specified table.
      Specified by:
      lockTable in interface Adapter
      Specified by:
      lockTable in class AbstractAdapter
      Parameters:
      con - The JDBC connection to use.
      table - The name of the table to lock.
      Throws:
      SQLException - No Statement could be created or executed.
    • unlockTable

      public void unlockTable(Connection con, String table) throws SQLException
      Unlocks the specified table.
      Specified by:
      unlockTable in interface Adapter
      Specified by:
      unlockTable in class AbstractAdapter
      Parameters:
      con - The JDBC connection to use.
      table - The name of the table to unlock.
      Throws:
      SQLException - No Statement could be created or executed.
    • generateLimits

      public void generateLimits(Query query, long offset, int limit)
      Generate a LIMIT limit OFFSET offset clause if offset > 0 or an LIMIT limit clause if limit is > 0 and offset is 0.
      Specified by:
      generateLimits in interface Adapter
      Overrides:
      generateLimits in class AbstractAdapter
      Parameters:
      query - The query to modify
      offset - the offset Value
      limit - the limit Value
    • useIlike

      public boolean useIlike()
      Whether ILIKE should be used for case insensitive like clauses. As postgres uses ILIKE, this mimplementation returns true.
      Specified by:
      useIlike in interface Adapter
      Overrides:
      useIlike in class AbstractAdapter
      Returns:
      true if ilike should be used for case insensitive likes, false if ignoreCase should be applied to the compared strings.