| java.lang.Object org.apache.torque.adapter.AbstractDBAdapter
All known Subclasses: org.apache.torque.adapter.DBOdbc, org.apache.torque.adapter.DBDerby, org.apache.torque.adapter.DBDB2App, org.apache.torque.adapter.DBInstantDB, org.apache.torque.adapter.DBInformix, org.apache.torque.adapter.DBPostgres, org.apache.torque.adapter.DBWeblogic, org.apache.torque.adapter.DBCloudscape, org.apache.torque.adapter.DBSybase, org.apache.torque.adapter.DBAxion, org.apache.torque.adapter.DBFirebird, org.apache.torque.adapter.DBHypersonicSQL, org.apache.torque.adapter.DBMM, org.apache.torque.adapter.DBOracle, org.apache.torque.adapter.DBSapDB, org.apache.torque.adapter.DBNone, org.apache.torque.adapter.DBInterbase,
AbstractDBAdapter | abstract public class AbstractDBAdapter implements DB(Code) | | 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
author: Jon S. Stevens author: Brett McLaughlin author: Daniel Rall author: Augustin Vidovic version: $Id: DB.java 393063 2006-04-10 20:59:16Z tfischer $ |
Method Summary | |
public boolean | escapeText() This method is for the SqlExpression.quoteAndEscape rules. | public 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. | public String | getBooleanString(Boolean b) This method is used to format a boolean string. | public String | getDateString(Date date) This method is used to format any date string. | abstract public String | getIDMethodSQL(Object obj) Returns SQL used to get the most recently inserted primary key.
Databases which have no support for this return
null .
Parameters: obj - Information used for key generation. | abstract public String | getIDMethodType() Returns the constant from the
org.apache.torque.adapter.IDMethod interface denoting which
type of primary key generation method this type of RDBMS uses. | public int | getLimitStyle() This method is used to check whether the database supports
limiting the size of the resultset. | public 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 public String | ignoreCase(String in) This method is used to ignore case.
Parameters: in - The string whose case to ignore. | public String | ignoreCaseInOrderBy(String in) This method is used to ignore case in an ORDER BY clause.
Usually it is the same as ignoreCase, but some databases
(Interbase for example) does not use the same SQL in ORDER BY
and other clauses.
Parameters: in - The string whose case to ignore. | abstract public void | lockTable(Connection con, String table) Locks the specified table. | public boolean | supportsNativeLimit() This method is used to check whether the database natively
supports limiting the size of the resultset. | public boolean | supportsNativeOffset() This method is used to check whether the database natively
supports returning results starting at an offset position other
than 0. | abstract public String | toUpperCase(String in) This method is used to ignore case.
Parameters: in - The string to transform to upper case. | abstract public void | unlockTable(Connection con, String table) Unlocks the specified table. | public boolean | useEscapeClauseForLike() Whether an escape clause in like should be used.
Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\';
As most databases do not need the escape clause, this implementation
always returns false . | public boolean | useIlike() Whether ILIKE should be used for case insensitive like clauses. |
AbstractDBAdapter | protected AbstractDBAdapter()(Code) | | Empty constructor.
|
escapeText | public boolean escapeText()(Code) | | 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 "\". SapDB does not need the escape character.
true if the database needs to escape text in SqlExpressions. |
generateLimits | public void generateLimits(Query query, int offset, int limit) throws TorqueException(Code) | | This method is used to generate the database specific query
extension to limit the number of record returned.
Parameters: query - The query to modify Parameters: offset - the offset Value Parameters: limit - the limit Value throws: TorqueException - if any error occurs when building the query |
getBooleanString | public String getBooleanString(Boolean b)(Code) | | This method is used to format a boolean string.
Parameters: b - the Boolean to format The proper date formatted String. |
getDateString | public String getDateString(Date date)(Code) | | This method is used to format any date string.
Database can use different default date formats.
Parameters: date - the Date to format The proper date formatted String. |
getIDMethodSQL | abstract public String getIDMethodSQL(Object obj)(Code) | | Returns SQL used to get the most recently inserted primary key.
Databases which have no support for this return
null .
Parameters: obj - Information used for key generation. The most recently inserted database key. |
getIDMethodType | abstract public String getIDMethodType()(Code) | | Returns the constant from the
org.apache.torque.adapter.IDMethod interface denoting which
type of primary key generation method this type of RDBMS uses.
IDMethod constant |
getLimitStyle | public int getLimitStyle()(Code) | | This method is used to check whether the database supports
limiting the size of the resultset.
The limit style for the database. |
getStringDelimiter | public char getStringDelimiter()(Code) | | Returns the character used to indicate the beginning and end of
a piece of text used in a SQL statement (generally a single
quote).
The text delimeter. |
ignoreCase | abstract public String ignoreCase(String in)(Code) | | This method is used to ignore case.
Parameters: in - The string whose case to ignore. The string in a case that can be ignored. |
ignoreCaseInOrderBy | public String ignoreCaseInOrderBy(String in)(Code) | | This method is used to ignore case in an ORDER BY clause.
Usually it is the same as ignoreCase, but some databases
(Interbase for example) does not use the same SQL in ORDER BY
and other clauses.
Parameters: in - The string whose case to ignore. The string in a case that can be ignored. |
lockTable | abstract public void lockTable(Connection con, String table) throws SQLException(Code) | | Locks the specified table.
Parameters: con - The JDBC connection to use. Parameters: table - The name of the table to lock. throws: SQLException - No Statement could be created or executed. |
supportsNativeLimit | public boolean supportsNativeLimit()(Code) | | This method is used to check whether the database natively
supports limiting the size of the resultset.
True if the database natively supports limiting thesize of the resultset. |
supportsNativeOffset | public boolean supportsNativeOffset()(Code) | | This method is used to check whether the database natively
supports returning results starting at an offset position other
than 0.
True if the database natively supports returningresults starting at an offset position other than 0. |
toUpperCase | abstract public String toUpperCase(String in)(Code) | | This method is used to ignore case.
Parameters: in - The string to transform to upper case. The upper case string. |
unlockTable | abstract public void unlockTable(Connection con, String table) throws SQLException(Code) | | Unlocks the specified table.
Parameters: con - The JDBC connection to use. Parameters: table - The name of the table to unlock. throws: SQLException - No Statement could be created or executed. |
useEscapeClauseForLike | public boolean useEscapeClauseForLike()(Code) | | Whether an escape clause in like should be used.
Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\';
As most databases do not need the escape clause, this implementation
always returns false . This behaviour can be overwritten
in subclasses.
whether the escape clause should be appended or not. |
useIlike | public boolean useIlike()(Code) | | Whether ILIKE should be used for case insensitive like clauses.
As most databases do not use ILIKE, this implementation returns false.
This behaviour may be overwritten in subclasses.
true if ilike should be used for case insensitive likes,false if ignoreCase should be applied to the compared strings. |
|
|