|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.torque.adapter.AbstractDBAdapter
public abstract class AbstractDBAdapter
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.
Torque uses the driver class name to find the right adapter.
A JDBC driver corresponding to your adapter must be added to the properties
file, using the fully-qualified class name of the driver. If no driver is
specified for your database, driver.default is used.
#### MySQL MM Driver database.default.driver=org.gjt.mm.mysql.Driver database.default.url=jdbc:mysql://localhost/DATABASENAME
| Field Summary |
|---|
| Fields inherited from interface org.apache.torque.adapter.DB |
|---|
ADAPTER_KEY, DRIVER_KEY, LIMIT_STYLE_DB2, LIMIT_STYLE_MYSQL, LIMIT_STYLE_NONE, LIMIT_STYLE_ORACLE, LIMIT_STYLE_POSTGRES, LIMIT_STYLE_SYBASE |
| Fields inherited from interface org.apache.torque.adapter.IDMethod |
|---|
AUTO_INCREMENT, ID_BROKER, NATIVE, NO_ID_METHOD, SEQUENCE |
| Constructor Summary | |
|---|---|
protected |
AbstractDBAdapter()
Empty constructor. |
| Method Summary | |
|---|---|
boolean |
escapeText()
This method is for the SqlExpression.quoteAndEscape rules. |
void |
generateLimits(Query query,
int offset,
int limit)
This method is used to generate the database specific query extension to limit the number of record returned. |
java.lang.String |
getBooleanString(java.lang.Boolean b)
This method is used to format a boolean string. |
java.lang.String |
getDateString(java.util.Date date)
This method is used to format any date string. |
java.lang.Class |
getFunctionClass(FunctionEnum function)
Return the class which implements the SQLFunction interface for the specified function. |
abstract java.lang.String |
getIDMethodSQL(java.lang.Object obj)
Returns SQL used to get the most recently inserted primary key. |
abstract java.lang.String |
getIDMethodType()
Returns the constant from the IDMethod interface denoting which
type of primary key generation method this type of RDBMS uses. |
int |
getLimitStyle()
Deprecated. This should not be exposed to the outside |
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). |
abstract java.lang.String |
ignoreCase(java.lang.String in)
This method is used to ignore case. |
java.lang.String |
ignoreCaseInOrderBy(java.lang.String in)
This method is used to ignore case in an ORDER BY clause. |
abstract void |
lockTable(java.sql.Connection con,
java.lang.String table)
Locks the specified table. |
boolean |
supportsNativeLimit()
This method is used to check whether the database natively supports limiting the size of the resultset. |
boolean |
supportsNativeOffset()
This method is used to check whether the database natively supports returning results starting at an offset position other than 0. |
abstract java.lang.String |
toUpperCase(java.lang.String in)
This method is used to ignore case. |
abstract void |
unlockTable(java.sql.Connection con,
java.lang.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 AbstractDBAdapter()
| Method Detail |
|---|
public abstract java.lang.String toUpperCase(java.lang.String in)
toUpperCase in interface DBin - The string to transform to upper case.
public char getStringDelimiter()
getStringDelimiter in interface DBpublic abstract java.lang.String getIDMethodType()
IDMethod interface denoting which
type of primary key generation method this type of RDBMS uses.
getIDMethodType in interface DBpublic abstract java.lang.String getIDMethodSQL(java.lang.Object obj)
null.
getIDMethodSQL in interface DBobj - Information used for key generation.
public abstract void lockTable(java.sql.Connection con,
java.lang.String table)
throws java.sql.SQLException
lockTable in interface DBcon - The JDBC connection to use.table - The name of the table to lock.
java.sql.SQLException - No Statement could be created or executed.
public abstract void unlockTable(java.sql.Connection con,
java.lang.String table)
throws java.sql.SQLException
unlockTable in interface DBcon - The JDBC connection to use.table - The name of the table to unlock.
java.sql.SQLException - No Statement could be created or executed.public abstract java.lang.String ignoreCase(java.lang.String in)
ignoreCase in interface DBin - The string whose case to ignore.
public java.lang.String ignoreCaseInOrderBy(java.lang.String in)
ignoreCaseInOrderBy in interface DBin - The string whose case to ignore.
public boolean supportsNativeLimit()
supportsNativeLimit in interface DBpublic boolean supportsNativeOffset()
supportsNativeOffset in interface DB
public void generateLimits(Query query,
int offset,
int limit)
throws TorqueException
generateLimits in interface DBquery - The query to modifyoffset - the offset Valuelimit - the limit Value
TorqueException - if any error occurs when building the querypublic boolean escapeText()
escapeText in interface DBpublic int getLimitStyle()
getLimitStyle in interface DBpublic java.lang.String getDateString(java.util.Date date)
getDateString in interface DBdate - the Date to format
public java.lang.String getBooleanString(java.lang.Boolean b)
getBooleanString in interface DBb - the Boolean to format
public boolean useIlike()
useIlike in interface DBpublic boolean useEscapeClauseForLike()
false. This behaviour can be overwritten
in subclasses.
useEscapeClauseForLike in interface DBpublic java.lang.Class getFunctionClass(FunctionEnum function)
getFunctionClass in interface DBfunction - The function to get the class for.
SQLFunction,
AbstractFunction,
Aggregate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||