org.objectweb.jorm.mapper.rdb.adapter
Class OracleAdapter

java.lang.Object
  |
  +--org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
        |
        +--org.objectweb.jorm.mapper.rdb.adapter.OracleAdapter
All Implemented Interfaces:
RdbAdapter
Direct Known Subclasses:
Oracle8Adapter

public class OracleAdapter
extends BasicRdbAdapter

Author:
S.Chassande-Barrioz

Field Summary
static java.util.Map properties
           
static java.lang.String[][] PROPS
           
 
Constructor Summary
OracleAdapter()
           
 
Method Summary
 boolean existSequence(java.sql.Connection connection, java.lang.String seqName)
           
 boolean existTable(java.sql.Connection connection, java.lang.String tableName)
           
 java.lang.String getFirstLocateExpression(java.lang.String substring, java.lang.String instring)
          Returns the expression for searching the position of the first occurrence of a substring in a string.
 java.lang.String getIndexedLocateExpression(java.lang.String instring, java.lang.String substring, java.lang.String fromIndex)
          Returns the expression for searching the position of the first occurrence of a substring in a string starting from a given index.
 java.lang.String getNextValInSequence(java.lang.String seqName)
           
 java.lang.String getSqlGetterName(PType pt, java.lang.String resultSet, int idx, java.lang.String sql)
          This method returns the sql getter method associated to the PType specified in parameter.
 java.lang.String getSqlType(PType pt, boolean usedInPK, int size)
          This method returns the SQL type linked to the PType specified in parameter.
 java.lang.String getSubstringName()
           
 java.lang.String handleOrderBy(java.lang.String query)
           
 void setVarcharSize(int s)
           
 void setVarcharSizeInPk(int s)
           
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 void writeTableAlias(java.lang.String alias, java.lang.StringBuffer sb)
          Used to write table aliases, for which the syntax may vary (use of 'as', except for Oracle)
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
fetchResultSetSize, getBigDecimal, getBoolean, getByte, getByteArray, getChar, getCharArray, getCharArray, getConcatExpression, getCreateSequence, getDate, getDate, getDouble, getFloat, getFromClause, getFromClause, getInt, getLong, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getSerialized, getShort, getSqlGetterName, getSqlSetterName, getSqlSetterName, getSqlTypeCode, getSqlTypeCode, getString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getWhereClause, setBigDecimal, setBoolean, setByte, setByteArray, setChar, setCharArray, setDate, setDouble, setFloat, setInt, setLong, setOboolean, setObyte, setOchar, setOdouble, setOfloat, setOint, setOlong, setOshort, setSerialized, setShort, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPS

public static final java.lang.String[][] PROPS

properties

public static final java.util.Map properties
Constructor Detail

OracleAdapter

public OracleAdapter()
Method Detail

setVarcharSize

public void setVarcharSize(int s)

setVarcharSizeInPk

public void setVarcharSizeInPk(int s)

supportBatchPreparedStatement

public boolean supportBatchPreparedStatement()
Description copied from interface: RdbAdapter
Indicates if the driver supports the batch of PreparedStatement

Specified by:
supportBatchPreparedStatement in interface RdbAdapter
Overrides:
supportBatchPreparedStatement in class BasicRdbAdapter

getSqlType

public java.lang.String getSqlType(PType pt,
                                   boolean usedInPK,
                                   int size)
                            throws PExceptionProtocol
Description copied from interface: RdbAdapter
This method returns the SQL type linked to the PType specified in parameter.

Specified by:
getSqlType in interface RdbAdapter
Overrides:
getSqlType in class BasicRdbAdapter
PExceptionProtocol

getSubstringName

public java.lang.String getSubstringName()
Specified by:
getSubstringName in interface RdbAdapter
Overrides:
getSubstringName in class BasicRdbAdapter

getFirstLocateExpression

public java.lang.String getFirstLocateExpression(java.lang.String substring,
                                                 java.lang.String instring)
Description copied from interface: RdbAdapter
Returns the expression for searching the position of the first occurrence of a substring in a string.

Two main syntaxes are found: position(substr in str) and instr(str, substr).

Specified by:
getFirstLocateExpression in interface RdbAdapter
Overrides:
getFirstLocateExpression in class BasicRdbAdapter
Parameters:
substring - The substring searched
instring - The string in which to search the substring
Returns:
The corresponding relational expression.

getIndexedLocateExpression

public java.lang.String getIndexedLocateExpression(java.lang.String instring,
                                                   java.lang.String substring,
                                                   java.lang.String fromIndex)
Description copied from interface: RdbAdapter
Returns the expression for searching the position of the first occurrence of a substring in a string starting from a given index.

Two main syntaxes are found: instr() and locate()

Specified by:
getIndexedLocateExpression in interface RdbAdapter
Overrides:
getIndexedLocateExpression in class BasicRdbAdapter
Parameters:
instring - The string in which to search the substring
substring - The substring searched
fromIndex - The index from which to start searching
Returns:
The corresponding relational expression.

getSqlGetterName

public java.lang.String getSqlGetterName(PType pt,
                                         java.lang.String resultSet,
                                         int idx,
                                         java.lang.String sql)
                                  throws PExceptionProtocol
Description copied from interface: RdbAdapter
This method returns the sql getter method associated to the PType specified in parameter. The returned string is the fetching of the value on the resultset to the specified index: "@resultSet.getBoolean(@idx)"

Specified by:
getSqlGetterName in interface RdbAdapter
Overrides:
getSqlGetterName in class BasicRdbAdapter
PExceptionProtocol

writeTableAlias

public void writeTableAlias(java.lang.String alias,
                            java.lang.StringBuffer sb)
Description copied from interface: RdbAdapter
Used to write table aliases, for which the syntax may vary (use of 'as', except for Oracle)

Specified by:
writeTableAlias in interface RdbAdapter
Overrides:
writeTableAlias in class BasicRdbAdapter
Parameters:
alias - The table alias
sb - The StringBuffer into which to write the alias.

handleOrderBy

public java.lang.String handleOrderBy(java.lang.String query)
Specified by:
handleOrderBy in interface RdbAdapter
Overrides:
handleOrderBy in class BasicRdbAdapter

getNextValInSequence

public java.lang.String getNextValInSequence(java.lang.String seqName)
Specified by:
getNextValInSequence in interface RdbAdapter
Overrides:
getNextValInSequence in class BasicRdbAdapter

existTable

public boolean existTable(java.sql.Connection connection,
                          java.lang.String tableName)
                   throws java.sql.SQLException
Specified by:
existTable in interface RdbAdapter
Overrides:
existTable in class BasicRdbAdapter
java.sql.SQLException

existSequence

public boolean existSequence(java.sql.Connection connection,
                             java.lang.String seqName)
                      throws java.sql.SQLException
Specified by:
existSequence in interface RdbAdapter
Overrides:
existSequence in class BasicRdbAdapter
java.sql.SQLException