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

java.lang.Object
  extended byorg.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
      extended byorg.objectweb.jorm.mapper.rdb.adapter.OracleAdapter
All Implemented Interfaces:
PreparedStatementAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter
Direct Known Subclasses:
Oracle8Adapter

public class OracleAdapter
extends BasicRdbAdapter

Author:
S.Chassande-Barrioz

Field Summary
private  int defaultBytearraySize
           
private  int defaultChararraySize
           
private static java.lang.String ORACLEFIRSTLOCATE
           
private static java.lang.String ORACLESUBSTRING
           
private static java.lang.String PROP_BASE
           
static java.util.Map properties
           
static java.lang.String[][] PROPS
           
private  int varcharSize
           
private  int varcharSizeInPk
           
 
Fields inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
name
 
Fields inherited from interface org.objectweb.jorm.mapper.rdb.adapter.api.RdbAdapter
NOSIZE
 
Fields inherited from interface org.objectweb.jorm.mapper.rdb.adapter.api.TypeAdapter
TYPE_NAMES, TYPECODE_BIGDECIMAL, TYPECODE_BIGINTEGER, TYPECODE_BOOLEAN, TYPECODE_BYTE, TYPECODE_BYTEARRAY, TYPECODE_CHAR, TYPECODE_CHARARRAY, TYPECODE_DATE, TYPECODE_DOUBLE, TYPECODE_FLOAT, TYPECODE_INT, TYPECODE_LONG, TYPECODE_OBJBOOLEAN, TYPECODE_OBJBYTE, TYPECODE_OBJCHAR, TYPECODE_OBJDOUBLE, TYPECODE_OBJFLOAT, TYPECODE_OBJINT, TYPECODE_OBJLONG, TYPECODE_OBJSHORT, TYPECODE_SERIALIZED, TYPECODE_SHORT, TYPECODE_STRING
 
Constructor Summary
OracleAdapter()
           
OracleAdapter(java.lang.String name)
           
 
Method Summary
protected  boolean existRelation(java.sql.Connection connection, java.lang.String relName, java.lang.String[] relationTypes)
           
 boolean existSequence(java.sql.Connection connection, java.lang.String seqName)
          checks the sequence existence
 java.lang.String getColumnAliasExpr(java.lang.String aliasName)
          Returns a column alias expression.
private static int getDefaultSize(int idx)
           
 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 getSqlType(int typeCode, boolean usedInPK, int size, int scale)
          This method returns the SQL type linked to the java type
 java.lang.String getSubstringName()
           
 java.lang.String handleOrderBy(java.lang.String query)
           
protected  void modifyWhereClauseWithRange(java.lang.StringBuffer sb, java.lang.String whereclause, int rangeStart, int rangeSize)
           
 void setVarcharSize(int s)
           
 void setVarcharSizeInPk(int s)
           
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 void writeColumnAlias(java.lang.String alias, java.lang.StringBuffer sb)
          Append a column alias to an SQL expression.
 void writeTableAlias(java.lang.String alias, java.lang.StringBuffer sb)
          Append a table alias to an SQL expression.
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
existTable, existView, fetchResultSetSize, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getCharArray, getConcatExpression, getCreateSequence, getCreateSequence, getDate, getDate, getDouble, getFloat, getFromClause, getFromClause, getINCREMENTkeyWord, getInt, getLengthOperator, getLong, getName, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getSerialized, getShort, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, getSubqueryAlias, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getWhereClause, modifySelectClauseWithRange, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setCharArray, setDate, setDouble, setFloat, setInt, setLong, setNull, 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

PROP_BASE

private static final java.lang.String PROP_BASE
See Also:
Constant Field Values

ORACLESUBSTRING

private static final java.lang.String ORACLESUBSTRING
See Also:
Constant Field Values

ORACLEFIRSTLOCATE

private static final java.lang.String ORACLEFIRSTLOCATE
See Also:
Constant Field Values

PROPS

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

properties

public static final java.util.Map properties

varcharSize

private int varcharSize

defaultBytearraySize

private int defaultBytearraySize

defaultChararraySize

private int defaultChararraySize

varcharSizeInPk

private int varcharSizeInPk
Constructor Detail

OracleAdapter

public OracleAdapter()

OracleAdapter

public OracleAdapter(java.lang.String name)
Method Detail

getDefaultSize

private static final int getDefaultSize(int idx)

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(int typeCode,
                                   boolean usedInPK,
                                   int size,
                                   int scale)
                            throws RdbAdapterException
Description copied from interface: TypeAdapter
This method returns the SQL type linked to the java type

Specified by:
getSqlType in interface TypeAdapter
Overrides:
getSqlType in class BasicRdbAdapter
Throws:
RdbAdapterException

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

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

writeTableAlias

public void writeTableAlias(java.lang.String alias,
                            java.lang.StringBuffer sb)
Description copied from interface: RdbAdapter
Append a table alias to an SQL expression. To be used when constructing the string expression of a from clause. For example, most database recognize the syntax 'select ... from R as ALIAS_FOR_R, S as ALIAS_FOR_S ... ' whereas Orabcle accepts the following syntax : 'select ... from R ALIAS_FOR_R, S ALIAS_FOR_S ... '

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

getColumnAliasExpr

public java.lang.String getColumnAliasExpr(java.lang.String aliasName)
Description copied from interface: RdbAdapter
Returns a column alias expression. To be used when constructing the string expression of a select clause. For example, most database recognize the syntax 'select A as ALIAS_FOR_A, B as ALIAS_FOR_B ... ' whereas Orabcle accepts the following syntax : 'select A "ALIAS_FOR_A", B "ALIAS_FOR_B" '

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

writeColumnAlias

public void writeColumnAlias(java.lang.String alias,
                             java.lang.StringBuffer sb)
Description copied from interface: RdbAdapter
Append a column alias to an SQL expression. To be used when constructing the string expression of a select clause. For example, most database recognize the syntax 'select A as ALIAS_FOR_A, B as ALIAS_FOR_B ... ' whereas Orabcle accepts the following syntax : 'select A "ALIAS_FOR_A", B "ALIAS_FOR_B" '

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

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 SequenceAdapter
Overrides:
getNextValInSequence in class BasicRdbAdapter

existRelation

protected boolean existRelation(java.sql.Connection connection,
                                java.lang.String relName,
                                java.lang.String[] relationTypes)
                         throws java.sql.SQLException
Overrides:
existRelation in class BasicRdbAdapter
Throws:
java.sql.SQLException

existSequence

public boolean existSequence(java.sql.Connection connection,
                             java.lang.String seqName)
                      throws java.sql.SQLException
Description copied from interface: SequenceAdapter
checks the sequence existence

Specified by:
existSequence in interface SequenceAdapter
Overrides:
existSequence in class BasicRdbAdapter
Throws:
java.sql.SQLException

modifyWhereClauseWithRange

protected void modifyWhereClauseWithRange(java.lang.StringBuffer sb,
                                          java.lang.String whereclause,
                                          int rangeStart,
                                          int rangeSize)
Overrides:
modifyWhereClauseWithRange in class BasicRdbAdapter