|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.adapter.AbstractAdapter
org.apache.torque.adapter.MysqlAdapter
public class MysqlAdapter
This is used in order to connect to a MySQL database using the MM drivers. Simply comment the above and uncomment this code below and fill in the appropriate values for DB_NAME, DB_HOST, DB_USER, DB_PASS.
"jdbc:mysql://" + DB_HOST + "/" + DB_NAME + "?user=" + DB_USER + "&password=" + DB_PASS;
Field Summary |
---|
Fields inherited from interface org.apache.torque.adapter.Adapter |
---|
ADAPTER_KEY, AUTODETECT_ADAPTER, DRIVER_KEY |
Constructor Summary | |
---|---|
protected |
MysqlAdapter()
Empty protected constructor. |
Method Summary | |
---|---|
void |
generateLimits(Query query,
long offset,
int limit)
Generate a LIMIT offset, limit clause if offset > 0 or an LIMIT limit clause if limit is > 0 and offset is 0. |
String |
getIDMethodSQL(Object obj)
Returns the SQL to get the database key of the last row inserted, which in this case is SELECT
LAST_INSERT_ID() . |
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. |
void |
lockTable(Connection con,
String table)
Locks the specified table. |
boolean |
supportsNativeLimit()
Return true for MySQL |
boolean |
supportsNativeOffset()
Return true for MySQL |
String |
toUpperCase(String in)
This method is used to ignore case. |
void |
unlockTable(Connection con,
String table)
Unlocks the specified table. |
Methods inherited from class org.apache.torque.adapter.AbstractAdapter |
---|
escapeText, getStringDelimiter, getUpdateLockClause, ignoreCaseInOrderBy, useEscapeClauseForLike, useIlike |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MysqlAdapter()
Method Detail |
---|
public String toUpperCase(String in)
toUpperCase
in interface Adapter
toUpperCase
in class AbstractAdapter
in
- The string to transform to upper case.
public String ignoreCase(String in)
ignoreCase
in interface Adapter
ignoreCase
in class AbstractAdapter
in
- The string whose case to ignore.
public IDMethod getIDMethodType()
AbstractAdapter
IDMethod
interface denoting which
type of primary key generation method this type of RDBMS uses.
getIDMethodType
in interface Adapter
getIDMethodType
in class AbstractAdapter
Adapter.getIDMethodType()
public String getIDMethodSQL(Object obj)
SELECT
LAST_INSERT_ID()
.
getIDMethodSQL
in interface Adapter
getIDMethodSQL
in class AbstractAdapter
obj
- Information used for key generation.
Adapter.getIDMethodSQL(Object obj)
public void lockTable(Connection con, String table) throws SQLException
lockTable
in interface Adapter
lockTable
in class AbstractAdapter
con
- The JDBC connection to use.table
- The name of the table to lock.
SQLException
- No Statement could be created or
executed.public void unlockTable(Connection con, String table) throws SQLException
unlockTable
in interface Adapter
unlockTable
in class AbstractAdapter
con
- The JDBC connection to use.table
- The name of the table to unlock.
SQLException
- No Statement could be created or
executed.public void generateLimits(Query query, long offset, int limit)
generateLimits
in interface Adapter
generateLimits
in class AbstractAdapter
query
- The query to modifyoffset
- the offset Valuelimit
- the limit Valuepublic boolean supportsNativeLimit()
supportsNativeLimit
in interface Adapter
supportsNativeLimit
in class AbstractAdapter
AbstractAdapter.supportsNativeLimit()
public boolean supportsNativeOffset()
supportsNativeOffset
in interface Adapter
supportsNativeOffset
in class AbstractAdapter
AbstractAdapter.supportsNativeOffset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |