org.apache.torque.adapter
Class HsqldbAdapter

java.lang.Object
  extended by org.apache.torque.adapter.AbstractAdapter
      extended by 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 1355228 2012-06-29 03:38:08Z tfischer $
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
protected HsqldbAdapter()
          Constructor.
 
Method Summary
 boolean escapeText()
          This method is for the SqlExpression.quoteAndEscape rules.
 String getIDMethodSQL(Object obj)
          Returns SQL used to get the most recently inserted primary key.
 IDMethod getIDMethodType()
          Returns the constant from the IDMethod 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.
 String ignoreCaseInOrderBy(String in)
          This method is used to ignore case in an ORDER BY clause.
 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 useEscapeClauseForLike()
          Whether an escape clause in like should be used.
 
Methods inherited from class org.apache.torque.adapter.AbstractAdapter
generateLimits, getStringDelimiter, getUpdateLockClause, supportsNativeLimit, supportsNativeOffset, useIlike
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HsqldbAdapter

protected HsqldbAdapter()
Constructor.

Method Detail

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:
Adapter.getIDMethodType()

ignoreCaseInOrderBy

public String ignoreCaseInOrderBy(String in)
Description copied from class: AbstractAdapter
This method is used to ignore case in an ORDER BY clause. Usually it is the same as ignoreCase, but some databases (hsqldb for example) do not use the same SQL in ORDER BY and other clauses.

Specified by:
ignoreCaseInOrderBy in interface Adapter
Overrides:
ignoreCaseInOrderBy in class AbstractAdapter
Parameters:
in - The string whose case to ignore.
Returns:
The string in a case that can be ignored.
See Also:
Adapter.ignoreCaseInOrderBy(String)

getIDMethodSQL

public String getIDMethodSQL(Object obj)
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:
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:
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.

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:
escapeText in interface Adapter
Overrides:
escapeText in class AbstractAdapter
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 returns true.

Specified by:
useEscapeClauseForLike in interface Adapter
Overrides:
useEscapeClauseForLike in class AbstractAdapter
Returns:
whether the escape clause should be appended or not.


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.