|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.adapter.AbstractAdapter
public abstract class AbstractAdapter
This class is the abstract base for any database adapter Support for new databases is added by subclassing this class and implementing its abstract methods, and by registering the new database adapter and its corresponding JDBC driver in the service configuration file.
The Torque database adapters exist to present a uniform interface to database access across all available databases. Once the necessary adapters have been written and configured, transparent swapping of databases is theoretically supported with zero code changes and minimal configuration file modifications.
Field Summary |
---|
Fields inherited from interface org.apache.torque.adapter.Adapter |
---|
ADAPTER_KEY, AUTODETECT_ADAPTER, DRIVER_KEY |
Constructor Summary | |
---|---|
protected |
AbstractAdapter()
Empty constructor. |
Method Summary | |
---|---|
boolean |
escapeText()
This method is for the SqlExpression.quoteAndEscape rules. |
void |
generateLimits(Query query,
long offset,
int limit)
This method is used to generate the database specific query extension to limit the number of record returned. |
abstract String |
getIDMethodSQL(Object obj)
Returns SQL used to get the most recently inserted primary key. |
abstract IDMethod |
getIDMethodType()
Returns the constant from the IDMethod interface denoting which
type of primary key generation method this type of RDBMS uses. |
char |
getStringDelimiter()
Returns the character used to indicate the beginning and end of a piece of text used in a SQL statement (generally a single quote). |
String |
getUpdateLockClause()
Returns the clause which acquires a write lock on a row when doing a select. |
abstract String |
ignoreCase(String in)
Wraps the input string in a database function to change it to a case-insensitive representation. |
String |
ignoreCaseInOrderBy(String in)
This method is used to ignore case in an ORDER BY clause. |
abstract void |
lockTable(Connection con,
String table)
Locks the specified table. |
boolean |
supportsNativeLimit()
Returns whether the database can natively limit the size of the ResultSet of a query. |
boolean |
supportsNativeOffset()
Returns whether the database natively supports returning results starting at an offset position other than 0. |
abstract String |
toUpperCase(String in)
Wraps the input string in a database function to change it to upper case. |
abstract void |
unlockTable(Connection con,
String table)
Unlocks the specified table. |
boolean |
useEscapeClauseForLike()
Whether an escape clause in like should be used. |
boolean |
useIlike()
Whether ILIKE should be used for case insensitive like clauses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractAdapter()
Method Detail |
---|
public abstract String toUpperCase(String in)
toUpperCase
in interface Adapter
in
- The string to transform to upper case, may be a literal string,
a prepared statement replacement placeholder(*) or any other
database expression.
public char getStringDelimiter()
getStringDelimiter
in interface Adapter
public abstract IDMethod getIDMethodType()
IDMethod
interface denoting which
type of primary key generation method this type of RDBMS uses.
getIDMethodType
in interface Adapter
public abstract String getIDMethodSQL(Object obj)
null
.
getIDMethodSQL
in interface Adapter
obj
- Information used for key generation.
public String getUpdateLockClause()
getUpdateLockClause
in interface Adapter
public abstract void lockTable(Connection con, String table) throws SQLException
lockTable
in interface Adapter
con
- The JDBC connection to use.table
- The name of the table to lock.
SQLException
- No Statement could be created or executed.public abstract void unlockTable(Connection con, String table) throws SQLException
unlockTable
in interface Adapter
con
- The JDBC connection to use.table
- The name of the table to unlock.
SQLException
- No Statement could be created or executed.public abstract String ignoreCase(String in)
ignoreCase
in interface Adapter
in
- The string to transform to a case-insensitive representation,
may be a literal string, a prepared statement replacement
placeholder(*) or any other database expression.
public String ignoreCaseInOrderBy(String in)
ignoreCaseInOrderBy
in interface Adapter
in
- The string whose case to ignore.
public boolean supportsNativeLimit()
supportsNativeLimit
in interface Adapter
public boolean supportsNativeOffset()
supportsNativeOffset
in interface Adapter
public void generateLimits(Query query, long offset, int limit) throws TorqueException
generateLimits
in interface Adapter
query
- The query to modifyoffset
- the offset Valuelimit
- the limit Value
TorqueException
- if any error occurs when building the querypublic boolean escapeText()
escapeText
in interface Adapter
public boolean useIlike()
useIlike
in interface Adapter
public boolean useEscapeClauseForLike()
false
. This behaviour can be overwritten
in subclasses.
useEscapeClauseForLike
in interface Adapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |