Package org.apache.torque.adapter
Class OracleAdapter
java.lang.Object
org.apache.torque.adapter.AbstractAdapter
org.apache.torque.adapter.OracleAdapter
- All Implemented Interfaces:
Serializable,Adapter
This code should be used for an Oracle database pool.
- Version:
- $Id: OracleAdapter.java 1917245 2024-04-21 14:06:23Z tv $
- Author:
- Jon S. Stevens, Brett McLaughlin, Bill Schneider, Daniel Rall
- See Also:
-
Field Summary
Fields inherited from interface org.apache.torque.adapter.Adapter
ADAPTER_KEY, AUTODETECT_ADAPTER, DRIVER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is for the SqlExpression.quoteAndEscape rules.voidgenerateLimits(Query query, long offset, int limit) Build Oracle-style query with limit or offset.getIDMethodSQL(Object sequenceName) Returns SQL used to get the most recently inserted primary key.Returns the constant from theIDMethodinterface denoting which type of primary key generation method this type of RDBMS uses.ignoreCase(String in) This method is used to ignore case.voidlockTable(Connection con, String table) Locks the specified table.toUpperCase(String in) This method is used to ignore case.voidunlockTable(Connection con, String table) Unlocks the specified table.booleanWhether an escape clause in like should be used.booleanWhether to use the MINUS operator instead of the EXCEPT operator.Methods inherited from class org.apache.torque.adapter.AbstractAdapter
getStringDelimiter, getUpdateLockClause, ignoreCaseInOrderBy, setCapabilities, supportsNativeLimit, supportsNativeOffset, useGetGeneratedKeys, useIlike
-
Constructor Details
-
OracleAdapter
protected OracleAdapter()Empty constructor.
-
-
Method Details
-
toUpperCase
This method is used to ignore case.- Specified by:
toUpperCasein interfaceAdapter- Specified by:
toUpperCasein classAbstractAdapter- Parameters:
in- The string to transform to upper case.- Returns:
- The upper case string.
-
ignoreCase
This method is used to ignore case.- Specified by:
ignoreCasein interfaceAdapter- Specified by:
ignoreCasein classAbstractAdapter- Parameters:
in- The string whose case to ignore.- Returns:
- The string in a case that can be ignored.
-
getIDMethodType
Description copied from class:AbstractAdapterReturns the constant from theIDMethodinterface denoting which type of primary key generation method this type of RDBMS uses.- Specified by:
getIDMethodTypein interfaceAdapter- Specified by:
getIDMethodTypein classAbstractAdapter- Returns:
- IDMethod constant
- See Also:
-
getIDMethodSQL
Description copied from class:AbstractAdapterReturns SQL used to get the most recently inserted primary key. Databases which have no support for this returnnull.- Specified by:
getIDMethodSQLin interfaceAdapter- Specified by:
getIDMethodSQLin classAbstractAdapter- Parameters:
sequenceName- The name of the sequence (should be of typeString).- Returns:
- SQL to retrieve the next database key.
- See Also:
-
lockTable
Locks the specified table.- Specified by:
lockTablein interfaceAdapter- Specified by:
lockTablein classAbstractAdapter- 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
Unlocks the specified table.- Specified by:
unlockTablein interfaceAdapter- Specified by:
unlockTablein classAbstractAdapter- Parameters:
con- The JDBC connection to use.table- The name of the table to unlock.- Throws:
SQLException- No Statement could be created or executed.
-
generateLimits
Build Oracle-style query with limit or offset. If the original SQL is in variable: query then the requlting SQL looks like this:SELECT B.* FROM ( SELECT A.*, rownum as TORQUE$ROWNUM FROM ( query ) A ) B WHERE B.TORQUE$ROWNUM > offset AND B.TORQUE$ROWNUM <= offset + limit- Specified by:
generateLimitsin interfaceAdapter- Overrides:
generateLimitsin classAbstractAdapter- Parameters:
query- The query to modifyoffset- the offset Valuelimit- the limit Value
-
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 "\". SapDB does not need the escape character.- Specified by:
escapeTextin interfaceAdapter- Overrides:
escapeTextin classAbstractAdapter- Returns:
- false.
-
useEscapeClauseForLike
public boolean useEscapeClauseForLike()Whether an escape clause in like should be used. Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\'; Oracle needs this, so this implementation always returnstrue.- Specified by:
useEscapeClauseForLikein interfaceAdapter- Overrides:
useEscapeClauseForLikein classAbstractAdapter- Returns:
- whether the escape clause should be appended or not.
-
useMinusForExcept
public boolean useMinusForExcept()Whether to use the MINUS operator instead of the EXCEPT operator. Oracle needs this, so this implementation always returnstrue.- Specified by:
useMinusForExceptin interfaceAdapter- Overrides:
useMinusForExceptin classAbstractAdapter- Returns:
- whether to use the MINUS operator instead of the EXCEPT operator.
-