Package org.apache.torque.adapter
Class HsqldbAdapter
- java.lang.Object
-
- org.apache.torque.adapter.AbstractAdapter
-
- org.apache.torque.adapter.HsqldbAdapter
-
- All Implemented Interfaces:
Serializable,Adapter
public class HsqldbAdapter extends AbstractAdapter
This is used to connect to Hsqldb databases. http://hsqldb.org/- Version:
- $Id: HsqldbAdapter.java 1848527 2018-12-09 16:27:22Z tv $
- Author:
- Christopher Elkins
- 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 protectedHsqldbAdapter()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanescapeText()This method is for the SqlExpression.quoteAndEscape rules.voidgenerateLimits(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.StringgetIDMethodSQL(Object obj)Returns SQL used to get the most recently inserted primary key.IDMethodgetIDMethodType()Returns the constant from theIDMethodinterface denoting which type of primary key generation method this type of RDBMS uses.StringignoreCase(String in)This method is used to ignore case.voidlockTable(Connection con, String table)Locks the specified table.StringtoUpperCase(String in)This method is used to ignore case.voidunlockTable(Connection con, String table)Unlocks the specified table.booleanuseEscapeClauseForLike()Whether an escape clause in like should be used.-
Methods inherited from class org.apache.torque.adapter.AbstractAdapter
getStringDelimiter, getUpdateLockClause, ignoreCaseInOrderBy, setCapabilities, supportsNativeLimit, supportsNativeOffset, useGetGeneratedKeys, useIlike, useMinusForExcept
-
-
-
-
Method Detail
-
toUpperCase
public String toUpperCase(String in)
This method is used to ignore case.- Specified by:
toUpperCasein interfaceAdapter- Specified by:
toUpperCasein 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:
ignoreCasein interfaceAdapter- Specified by:
ignoreCasein 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:AbstractAdapterReturns the constant from theIDMethodinterface denoting which type of primary key generation method this type of RDBMS uses.- Specified by:
getIDMethodTypein interfaceAdapter- Specified by:
getIDMethodTypein classAbstractAdapter- Returns:
- IDMethod constant
- See Also:
Adapter.getIDMethodType()
-
getIDMethodSQL
public String getIDMethodSQL(Object obj)
Description copied from class:AbstractAdapterReturns SQL used to get the most recently inserted primary key. Databases which have no support for this returnnull.- Specified by:
getIDMethodSQLin interfaceAdapter- Specified by:
getIDMethodSQLin classAbstractAdapter- Parameters:
obj- Information used for key generation.- Returns:
- The most recently inserted database key.
- See Also:
Adapter.getIDMethodSQL(Object obj)
-
lockTable
public void lockTable(Connection con, String table) throws SQLException
Locks the specified table.- Specified by:
lockTablein interfaceAdapter- Specified by:
lockTablein 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:
unlockTablein interfaceAdapter- Specified by:
unlockTablein 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.
-
escapeText
public boolean escapeText()
This method is for the SqlExpression.quoteAndEscape rules. The rule is, any string in a SqlExpression with a BACKSLASH will either be changed to "\\" or left as "\".- Specified by:
escapeTextin interfaceAdapter- Overrides:
escapeTextin classAbstractAdapter- Returns:
- false.
-
useEscapeClauseForLike
public boolean useEscapeClauseForLike()
Whether an escape clause in like should be used. Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\'; HSQLDB needs this, so this implementation always returnstrue.- Specified by:
useEscapeClauseForLikein interfaceAdapter- Overrides:
useEscapeClauseForLikein classAbstractAdapter- Returns:
- whether the escape clause should be appended or not.
-
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:
generateLimitsin interfaceAdapter- Overrides:
generateLimitsin classAbstractAdapter- Parameters:
query- The query to modifyoffset- the offset Valuelimit- the limit Value
-
-