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

java.lang.Object
  extended byorg.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
      extended byorg.objectweb.jorm.mapper.rdb.adapter.Db2Adapter
All Implemented Interfaces:
IndexAdapter, PreparedStatementAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter

public class Db2Adapter
extends BasicRdbAdapter

Author:
S. Chassande-Barrioz, J. Camilleri, L. Peerdeman

Field Summary
private static int DEFAULTVARCHARSIZE
           
private static int DEFAULTVARCHARSIZEINPK
           
private  int varcharSize
           
private  int varcharSizeInPk
           
 
Fields inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
logger, name
 
Fields inherited from interface org.objectweb.jorm.mapper.rdb.adapter.api.RdbAdapter
NOSIZE, RANGEATEND, RANGEATSTART, RANGEUNSUPPORTED
 
Fields inherited from interface org.objectweb.jorm.mapper.rdb.adapter.api.TypeAdapter
TYPE_NAMES, TYPECODE_ARRAY, 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
Db2Adapter()
           
 
Method Summary
 boolean existRelation(java.sql.Connection connection, java.lang.String relName, java.lang.String[] names)
           
 boolean existSequence(java.sql.Connection conn, java.lang.String seqName)
          checks the sequence existence
 java.lang.String getColumnAliasExpr(java.lang.String aliasName)
          Returns a column alias expression.
 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 getValueAsSQLString(java.lang.Object value, int typeCode)
          This method returns a String value that represents a value.
 void setVarcharSize(int s)
           
 void setVarcharSizeInPk(int s)
           
 void writeColumnAlias(java.lang.String alias, java.lang.StringBuffer sb)
          OL: I'm not sure of this, i didn't manage to have the exact syntax for column alaiases with DB2 :o(
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
appendClause, escapeFunctionClose, escapeFunctionOpen, existTable, existView, fetchResultSetSize, getArray, getArrayElementAsSQLString, getArrayToString, getArrayToStringBegin, getArrayToStringEnd, getArrayToStringSeparator, getArrayValueAsSQLString, getArrayValueAsSQLString, getArrayValueAsSQLStringBegin, getArrayValueAsSQLStringEnd, getArrayValueAsSQLStringSeparator, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getCharArray, getConcatExpression, getCreateIndex, getCreateSequence, getCreateSequence, getDate, getDate, getDouble, getDropIndex, getDropSequence, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getFromClause, getINCREMENTkeyWord, getIndexedLocateExpression, getInt, getLengthOperator, getLong, getManyNextValInSequence, getName, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getQuery, getRangeParametersAtStart, getSerialized, getShort, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, getSubqueryAlias, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, handleOrderBy, modifyQueryWithRange, modifySelectClauseWithRange, setArray, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setCharArray, setDate, setDouble, setFloat, setInt, setLogger, setLong, setNull, setOboolean, setObyte, setOchar, setOdouble, setOfloat, setOint, setOlong, setOshort, setSerialized, setShort, setString, supportArray, supportBatchPreparedStatement, writeTableAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTVARCHARSIZE

private static final int DEFAULTVARCHARSIZE
See Also:
Constant Field Values

DEFAULTVARCHARSIZEINPK

private static final int DEFAULTVARCHARSIZEINPK
See Also:
Constant Field Values

varcharSize

private int varcharSize

varcharSizeInPk

private int varcharSizeInPk
Constructor Detail

Db2Adapter

public Db2Adapter()
Method Detail

setVarcharSize

public void setVarcharSize(int s)

setVarcharSizeInPk

public void setVarcharSizeInPk(int s)

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

writeColumnAlias

public void writeColumnAlias(java.lang.String alias,
                             java.lang.StringBuffer sb)
OL: I'm not sure of this, i didn't manage to have the exact syntax for column alaiases with DB2 :o(

Specified by:
writeColumnAlias in interface RdbAdapter
Overrides:
writeColumnAlias in class BasicRdbAdapter
Parameters:
alias -
sb -

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

existRelation

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

getNextValInSequence

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

existSequence

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

Specified by:
existSequence in interface SequenceAdapter
Overrides:
existSequence in class BasicRdbAdapter

getValueAsSQLString

public java.lang.String getValueAsSQLString(java.lang.Object value,
                                            int typeCode)
Description copied from interface: ValueAsSQLStringAdapter
This method returns a String value that represents a value. This method can be used for the constant parameters of SQL queries.

Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter
Overrides:
getValueAsSQLString in class BasicRdbAdapter