org.objectweb.jorm.mapper.rdb.adapter

Class OracleAdapter

Implemented Interfaces:
PreparedStatementAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter
Known Direct Subclasses:
Oracle8Adapter

public class OracleAdapter
extends BasicRdbAdapter

Author:
S.Chassande-Barrioz

Field Summary

private static String
ORACLEFIRSTLOCATE
static String[][]
PROPS
private static String
PROP_BASE
private int
defaultBytearraySize
private int
defaultChararraySize
static Map
properties
private int
varcharSize
private int
varcharSizeInPk

Fields inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter

CONCAT, INDEXEDLOCATE, accountForNanos, 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

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, TYPE_NAMES

Constructor Summary

OracleAdapter()
OracleAdapter(String name)

Method Summary

protected boolean
existRelation(Connection connection, String relName, String[] relationTypes)
boolean
existSequence(Connection connection, String seqName)
String
getColumnAliasExpr(String aliasName)
private static int
getDefaultSize(int idx)
String
getFirstLocateExpression(String substring, String instring)
String
getIndexedLocateExpression(String instring, String substring, String fromIndex)
String
getNextValInSequence(String seqName)
String
getSqlType(int typeCode, boolean usedInPK, int size, int scale)
This method returns the SQL type linked to the java type
String
handleOrderBy(String query)
protected void
modifyWhereClauseWithRange(StringBuffer sb, String whereclause, int rangeStart, int rangeSize)
void
setVarcharSize(int s)
void
setVarcharSizeInPk(int s)
boolean
supportBatchPreparedStatement()
void
writeColumnAlias(String alias, StringBuffer sb)
void
writeTableAlias(String alias, StringBuffer sb)

Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter

escapeFunctionClose, escapeFunctionOpen, existRelation, existSequence, existTable, existView, fetchResultSetSize, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getCharArray, getCharArray, getColumnAliasExpr, getConcatExpression, getCreateSequence, getCreateSequence, getDate, getDate, getDouble, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getINCREMENTkeyWord, getIndexedLocateExpression, getInt, getLengthOperator, getLong, getName, getNextValInSequence, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getSTARTkeyWord, getSerialized, getShort, getSqlType, getSqlTypeCode, getSqlTypeCode, getString, getSubqueryAlias, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getWhereClause, handleOrderBy, modifySelectClauseWithRange, modifyWhereClauseWithRange, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setCharArray, setDate, setDouble, setFloat, setInt, setLong, setNull, setOboolean, setObyte, setOchar, setOdouble, setOfloat, setOint, setOlong, setOshort, setSerialized, setShort, setString, sqldate2date, supportBatchPreparedStatement, time2date, timestamp2date, writeColumnAlias, writeTableAlias

Field Details

ORACLEFIRSTLOCATE

private static final String ORACLEFIRSTLOCATE


PROPS

public static final String[][] PROPS


PROP_BASE

private static final String PROP_BASE


defaultBytearraySize

private int defaultBytearraySize


defaultChararraySize

private int defaultChararraySize


properties

public static final Map properties


varcharSize

private int varcharSize


varcharSizeInPk

private int varcharSizeInPk

Constructor Details

OracleAdapter

public OracleAdapter()


OracleAdapter

public OracleAdapter(String name)

Method Details

existRelation

protected boolean existRelation(Connection connection,
                                String relName,
                                String[] relationTypes)
            throws SQLException
Overrides:
existRelation in interface BasicRdbAdapter


existSequence

public boolean existSequence(Connection connection,
                             String seqName)
            throws SQLException
Specified by:
existSequence in interface SequenceAdapter
Overrides:
existSequence in interface BasicRdbAdapter


getColumnAliasExpr

public String getColumnAliasExpr(String aliasName)
Specified by:
getColumnAliasExpr in interface RdbAdapter
Overrides:
getColumnAliasExpr in interface BasicRdbAdapter


getDefaultSize

private static final int getDefaultSize(int idx)


getFirstLocateExpression

public String getFirstLocateExpression(String substring,
                                       String instring)
Specified by:
getFirstLocateExpression in interface RdbAdapter
Overrides:
getFirstLocateExpression in interface BasicRdbAdapter


getIndexedLocateExpression

public String getIndexedLocateExpression(String instring,
                                         String substring,
                                         String fromIndex)
Specified by:
getIndexedLocateExpression in interface RdbAdapter
Overrides:
getIndexedLocateExpression in interface BasicRdbAdapter


getNextValInSequence

public String getNextValInSequence(String seqName)
Specified by:
getNextValInSequence in interface SequenceAdapter
Overrides:
getNextValInSequence in interface BasicRdbAdapter


getSqlType

public String getSqlType(int typeCode,
                         boolean usedInPK,
                         int size,
                         int scale)
            throws RdbAdapterException
This method returns the SQL type linked to the java type
Specified by:
getSqlType in interface TypeAdapter
Overrides:
getSqlType in interface BasicRdbAdapter

Parameters:
typeCode - is the type code of the java type
usedInPK - indicates if the type has to be used into a Primary key
size - can indicates the expected size of the type. If it equals to NO_SIZE that means no size is expected. This parameter can be used for float, BigXXX numbers, String,...
scale - can indicates the expected scale of the type. If it equals to NO_SIZE that means no scale is expected.


handleOrderBy

public String handleOrderBy(String query)
Specified by:
handleOrderBy in interface RdbAdapter
Overrides:
handleOrderBy in interface BasicRdbAdapter


modifyWhereClauseWithRange

protected void modifyWhereClauseWithRange(StringBuffer sb,
                                          String whereclause,
                                          int rangeStart,
                                          int rangeSize)
Overrides:
modifyWhereClauseWithRange in interface BasicRdbAdapter


setVarcharSize

public void setVarcharSize(int s)


setVarcharSizeInPk

public void setVarcharSizeInPk(int s)


supportBatchPreparedStatement

public boolean supportBatchPreparedStatement()
Specified by:
supportBatchPreparedStatement in interface RdbAdapter
Overrides:
supportBatchPreparedStatement in interface BasicRdbAdapter


writeColumnAlias

public void writeColumnAlias(String alias,
                             StringBuffer sb)
Specified by:
writeColumnAlias in interface RdbAdapter
Overrides:
writeColumnAlias in interface BasicRdbAdapter


writeTableAlias

public void writeTableAlias(String alias,
                            StringBuffer sb)
Specified by:
writeTableAlias in interface RdbAdapter
Overrides:
writeTableAlias in interface BasicRdbAdapter