Package org.apache.torque.adapter
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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.torque.adapter.Adapter
ADAPTER_KEY, AUTODETECT_ADAPTER, DRIVER_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PostgresAdapter()
Empty constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.String
getIDMethodSQL(Object name)
Returns SQL used to get the most recently inserted primary key.IDMethod
getIDMethodType()
Returns the constant from theIDMethod
interface denoting which type of primary key generation method this type of RDBMS uses.String
ignoreCase(String in)
This method is used to ignore case.void
lockTable(Connection con, String table)
Locks the specified table.String
toUpperCase(String in)
This method is used to ignore case.void
unlockTable(Connection con, String table)
Unlocks the specified table.boolean
useIlike()
Whether ILIKE should be used for case insensitive like clauses.-
Methods inherited from class org.apache.torque.adapter.AbstractAdapter
escapeText, getStringDelimiter, getUpdateLockClause, ignoreCaseInOrderBy, setCapabilities, supportsNativeLimit, supportsNativeOffset, useEscapeClauseForLike, useGetGeneratedKeys, useMinusForExcept
-
-
-
-
Method Detail
-
toUpperCase
public String toUpperCase(String in)
This method is used to ignore case.- Specified by:
toUpperCase
in interfaceAdapter
- Specified by:
toUpperCase
in classAbstractAdapter
- 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 interfaceAdapter
- Specified by:
ignoreCase
in classAbstractAdapter
- 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 theIDMethod
interface denoting which type of primary key generation method this type of RDBMS uses.- Specified by:
getIDMethodType
in interfaceAdapter
- Specified by:
getIDMethodType
in classAbstractAdapter
- Returns:
- IDMethod constant
- See Also:
Adapter.getIDMethodType()
-
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 returnnull
.- Specified by:
getIDMethodSQL
in interfaceAdapter
- Specified by:
getIDMethodSQL
in classAbstractAdapter
- Parameters:
name
- The name of the field (should be of typeString
).- Returns:
- SQL to retreive the next database key.
- See Also:
Adapter.getIDMethodSQL(Object)
-
lockTable
public void lockTable(Connection con, String table) throws SQLException
Locks the specified table.- Specified by:
lockTable
in interfaceAdapter
- Specified by:
lockTable
in classAbstractAdapter
- 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 interfaceAdapter
- Specified by:
unlockTable
in classAbstractAdapter
- 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 interfaceAdapter
- Overrides:
generateLimits
in classAbstractAdapter
- Parameters:
query
- The query to modifyoffset
- the offset Valuelimit
- 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 interfaceAdapter
- Overrides:
useIlike
in classAbstractAdapter
- Returns:
- true if ilike should be used for case insensitive likes, false if ignoreCase should be applied to the compared strings.
-
-