org.objectweb.jorm.mapper.rdb.adapter

Class BasicRdbAdapter

Implemented Interfaces:
PreparedStatementAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter
Known Direct Subclasses:
CloudscapeAdapter, Db2Adapter, FirebirdAdapter, HsqlAdapter, MckoiAdapter, MysqlAdapter, OracleAdapter, PostgresAdapter, ProgressAdapter, SapdbAdapter, SqlserverAdapter, SybaseAdapter

public class BasicRdbAdapter
extends java.lang.Object
implements RdbAdapter

JORM: an implementation of a generic mapping system for persistent Java objects. Two mapping are supported: to RDBMS and to binary files. Copyright (C) 2001-2004 France Telecom R&D - INRIA This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: jorm-team@objectweb.org

Field Summary

private static String
CONCAT
private static String
INDEXEDLOCATE
private static boolean
accountForNanos
protected String
name
Is the name of the RdbAdapter.

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

BasicRdbAdapter()
BasicRdbAdapter(String name)

Method Summary

void
escapeFunctionClose(StringBuffer sb)
void
escapeFunctionOpen(StringBuffer sb)
protected boolean
existRelation(Connection connection, String relName, String[] relationTypes)
boolean
existSequence(Connection connection, String seqName)
checks the sequence existence
boolean
existTable(Connection connection, String tableName)
boolean
existView(Connection connection, String viewName)
int
fetchResultSetSize(ResultSet rs)
This calculates the size of a result set.
BigDecimal
getBigDecimal(ResultSet rs, int idx, BigDecimal nullValue)
Get a BigDecimal value from a ResultSet.
BigInteger
getBigInteger(ResultSet rs, int idx, BigInteger nullValue)
Get a BigInteger value from a ResultSet.
boolean
getBoolean(ResultSet rs, int idx, boolean nullValue)
Get a boolean value from a ResultSet.
byte
getByte(ResultSet rs, int idx, byte nullValue)
Get a byte value from a ResultSet.
byte[]
getByteArray(ResultSet rs, int idx, byte[] nullValue)
Get a byte[] value from a ResultSet.
protected String
getCACHEkeyWord()
char
getChar(ResultSet rs, int idx, char nullValue)
Get a char value from a ResultSet.
static char[]
getCharArray(Object o)
char[]
getCharArray(ResultSet rs, int idx, char[] nullValue)
Get a char[] value from a ResultSet.
private static char[]
getCharArray(java.io.Reader reader)
String
getColumnAliasExpr(String aliasName)
String
getConcatExpression(String op1, String op2)
String
getCreateSequence(String seqName)
String
getCreateSequence(String seqName, Integer startid, Integer inc, Integer cache)
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ] [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
Date
getDate(ResultSet rs, int idx, Date nullValue)
Get a Date value from a ResultSet.
Date
getDate(ResultSet rs, int idx, String sqlColumnType, Date nullValue)
Get a Date value from a ResultSet.
double
getDouble(ResultSet rs, int idx, double nullValue)
Get a double value from a ResultSet.
String
getFirstLocateExpression(String substring, String instring)
float
getFloat(ResultSet rs, int idx, float nullValue)
Get a float value from a ResultSet.
protected void
getFromClause(JoinedTable jt, StringBuffer sb)
protected void
getFromClause(JoinedTable jtMain, JoinedTable jt, JoinedTable.Join join, StringBuffer sb)
protected String
getINCREMENTkeyWord()
String
getIndexedLocateExpression(String instring, String substring, String fromIndex)
int
getInt(ResultSet rs, int idx, int nullValue)
Get a int value from a ResultSet.
String
getLengthOperator()
long
getLong(ResultSet rs, int idx, long nullValue)
Get a long value from a ResultSet.
String
getName()
String
getNextValInSequence(String seqName)
Boolean
getOboolean(ResultSet rs, int idx, Boolean nullValue)
Get a Boolean value from a ResultSet.
Byte
getObyte(ResultSet rs, int idx, Byte nullValue)
Get a Byte value from a ResultSet.
Character
getOchar(ResultSet rs, int idx, Character nullValue)
Get a Character value from a ResultSet.
Double
getOdouble(ResultSet rs, int idx, Double nullValue)
Get a Double value from a ResultSet.
Float
getOfloat(ResultSet rs, int idx, Float nullValue)
Get a Float value from a ResultSet.
Integer
getOint(ResultSet rs, int idx, Integer nullValue)
Get a Integer value from a ResultSet.
Long
getOlong(ResultSet rs, int idx, Long nullValue)
Get a Long value from a ResultSet.
Short
getOshort(ResultSet rs, int idx, Short nullValue)
Get a Short value from a ResultSet.
String
getQuery(String selectClause, List jts, String whereclause, int rangeStart, int rangeSize)
protected String
getSTARTkeyWord()
Serializable
getSerialized(ResultSet rs, int idx, Serializable nullValue)
Get a Serializable value from a ResultSet.
short
getShort(ResultSet rs, int idx, short nullValue)
Get a short value from a ResultSet.
String
getSqlType(int typeCode, boolean usedInPK, int size, int scale)
This method returns the SQL type linked to the java type
int
getSqlTypeCode(int typeCode)
This methods return the SQL type code linked to the java type specified in parameter.
int
getSqlTypeCode(int typeCode, String sqlColumnType)
This methods return the SQL type code linked to the java type specified in parameter.
String
getString(ResultSet rs, int idx, String nullValue)
Get a String value from a ResultSet.
String
getSubqueryAlias()
String
getValueAsSQLString(Object value, int typeCode)
This method returns a String value that represents a value.
String
getValueAsSQLString(boolean value)
This method returns a String value that represents a boolean value.
String
getValueAsSQLString(byte value)
This method returns a String value that represents a byte value.
String
getValueAsSQLString(char value)
This method returns a String value that represents a char value.
String
getValueAsSQLString(double value)
This method returns a String value that represents a double value.
String
getValueAsSQLString(float value)
This method returns a String value that represents a float value.
String
getValueAsSQLString(int value)
This method returns a String value that represents a int value.
String
getValueAsSQLString(long value)
This method returns a String value that represents a long value.
String
getValueAsSQLString(short value)
This method returns a String value that represents a short value.
protected void
getWhereClause(List jts, StringBuffer sb, String whereclause, int rangeStart, int rangeSize)
String
handleOrderBy(String query)
protected void
modifySelectClauseWithRange(StringBuffer sb, int rangeStart, int rangeSize)
protected void
modifyWhereClauseWithRange(StringBuffer sb, String where, int rangeStart, int rangeSize)
void
setBigDecimal(PreparedStatement ps, int idx, BigDecimal o)
Assignes a value into a PreparedStatement
void
setBigInteger(PreparedStatement ps, int idx, BigInteger o)
Assignes a value into a PreparedStatement
void
setBoolean(PreparedStatement ps, int idx, boolean o)
Assignes a value into a PreparedStatement
void
setByte(PreparedStatement ps, int idx, byte o)
Assignes a value into a PreparedStatement
void
setByteArray(PreparedStatement ps, int idx, byte[] o)
Assignes a value into a PreparedStatement
void
setChar(PreparedStatement ps, int idx, char c)
Assignes a value into a PreparedStatement
void
setCharArray(PreparedStatement ps, int idx, char[] o)
Assignes a value into a PreparedStatement
void
setDate(PreparedStatement ps, int idx, Date o, String columnType)
Assignes a value into a PreparedStatement
void
setDouble(PreparedStatement ps, int idx, double o)
Assignes a value into a PreparedStatement
void
setFloat(PreparedStatement ps, int idx, float o)
Assignes a value into a PreparedStatement
void
setInt(PreparedStatement ps, int idx, int o)
Assignes a value into a PreparedStatement
void
setLong(PreparedStatement ps, int idx, long o)
Assignes a value into a PreparedStatement
void
setNull(PreparedStatement ps, int idx, int sqlType)
Assignes a null value into a PreparedStatement
void
setOboolean(PreparedStatement ps, int idx, Boolean o)
Assignes a value into a PreparedStatement
void
setObyte(PreparedStatement ps, int idx, Byte o)
Assignes a value into a PreparedStatement
void
setOchar(PreparedStatement ps, int idx, Character o)
Assignes a value into a PreparedStatement
void
setOdouble(PreparedStatement ps, int idx, Double o)
Assignes a value into a PreparedStatement
void
setOfloat(PreparedStatement ps, int idx, Float o)
Assignes a value into a PreparedStatement
void
setOint(PreparedStatement ps, int idx, Integer o)
Assignes a value into a PreparedStatement
void
setOlong(PreparedStatement ps, int idx, Long o)
Assignes a value into a PreparedStatement
void
setOshort(PreparedStatement ps, int idx, Short o)
Assignes a value into a PreparedStatement
void
setSerialized(PreparedStatement ps, int idx, Serializable o)
Assignes a value into a PreparedStatement
void
setShort(PreparedStatement ps, int idx, short o)
Assignes a value into a PreparedStatement
void
setString(PreparedStatement ps, int idx, String o)
Assignes a value into a PreparedStatement
private static Date
sqldate2date(java.sql.Date d)
boolean
supportBatchPreparedStatement()
private static Date
time2date(java.sql.Time t)
private static Date
timestamp2date(java.sql.Timestamp tstamp)
void
writeColumnAlias(String alias, StringBuffer sb)
void
writeTableAlias(String alias, StringBuffer sb)

Field Details

CONCAT

private static final String CONCAT


INDEXEDLOCATE

private static final String INDEXEDLOCATE


accountForNanos

private static final boolean accountForNanos


name

protected String name
Is the name of the RdbAdapter. The name is used, in particular, in the RdbAdapter factory for choosing an adapter.

Constructor Details

BasicRdbAdapter

public BasicRdbAdapter()


BasicRdbAdapter

public BasicRdbAdapter(String name)

Method Details

escapeFunctionClose

public void escapeFunctionClose(StringBuffer sb)
Specified by:
escapeFunctionClose in interface RdbAdapter


escapeFunctionOpen

public void escapeFunctionOpen(StringBuffer sb)
Specified by:
escapeFunctionOpen in interface RdbAdapter


existRelation

protected boolean existRelation(Connection connection,
                                String relName,
                                String[] relationTypes)
            throws SQLException


existSequence

public boolean existSequence(Connection connection,
                             String seqName)
            throws SQLException
checks the sequence existence
Specified by:
existSequence in interface SequenceAdapter

Parameters:
connection - is the JDBC connection to use
seqName - is the sequence of the table

Returns:
true if the table exists, otherwise false.


existTable

public boolean existTable(Connection connection,
                          String tableName)
            throws SQLException
Specified by:
existTable in interface RdbAdapter


existView

public boolean existView(Connection connection,
                         String viewName)
            throws SQLException
Specified by:
existView in interface RdbAdapter


fetchResultSetSize

public int fetchResultSetSize(ResultSet rs)
            throws SQLException
This calculates the size of a result set. If this feature is not supported by a database or its jdbc driver, this method returns -1.
Specified by:
fetchResultSetSize in interface RdbAdapter

Parameters:
rs - the result set which the size must be returned


getBigDecimal

public BigDecimal getBigDecimal(ResultSet rs,
                                int idx,
                                BigDecimal nullValue)
            throws SQLException
Get a BigDecimal value from a ResultSet.
Specified by:
getBigDecimal in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getBigInteger

public BigInteger getBigInteger(ResultSet rs,
                                int idx,
                                BigInteger nullValue)
            throws SQLException
Get a BigInteger value from a ResultSet.
Specified by:
getBigInteger in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getBoolean

public boolean getBoolean(ResultSet rs,
                          int idx,
                          boolean nullValue)
            throws SQLException
Get a boolean value from a ResultSet.
Specified by:
getBoolean in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getByte

public byte getByte(ResultSet rs,
                    int idx,
                    byte nullValue)
            throws SQLException
Get a byte value from a ResultSet.
Specified by:
getByte in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getByteArray

public byte[] getByteArray(ResultSet rs,
                           int idx,
                           byte[] nullValue)
            throws SQLException
Get a byte[] value from a ResultSet.
Specified by:
getByteArray in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getCACHEkeyWord

protected String getCACHEkeyWord()


getChar

public char getChar(ResultSet rs,
                    int idx,
                    char nullValue)
            throws SQLException
Get a char value from a ResultSet.
Specified by:
getChar in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getCharArray

public static char[] getCharArray(Object o)
            throws IOException,
                   RdbAdapterException


getCharArray

public char[] getCharArray(ResultSet rs,
                           int idx,
                           char[] nullValue)
            throws SQLException
Get a char[] value from a ResultSet.
Specified by:
getCharArray in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getCharArray

private static char[] getCharArray(java.io.Reader reader)
            throws java.io.IOException


getColumnAliasExpr

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


getConcatExpression

public String getConcatExpression(String op1,
                                  String op2)
Specified by:
getConcatExpression in interface RdbAdapter


getCreateSequence

public String getCreateSequence(String seqName)
            throws UnsupportedOperationException
Specified by:
getCreateSequence in interface SequenceAdapter

Parameters:
seqName - is the sequence name

Returns:
the SQL command to create a sequence


getCreateSequence

public String getCreateSequence(String seqName,
                                Integer startid,
                                Integer inc,
                                Integer cache)
            throws UnsupportedOperationException
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ] [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
Specified by:
getCreateSequence in interface SequenceAdapter

Parameters:
seqName -
startid -
inc -


getDate

public Date getDate(ResultSet rs,
                    int idx,
                    Date nullValue)
            throws SQLException
Get a Date value from a ResultSet.
Specified by:
getDate in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getDate

public Date getDate(ResultSet rs,
                    int idx,
                    String sqlColumnType,
                    Date nullValue)
            throws SQLException
Get a Date value from a ResultSet.
Specified by:
getDate in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getDouble

public double getDouble(ResultSet rs,
                        int idx,
                        double nullValue)
            throws SQLException
Get a double value from a ResultSet.
Specified by:
getDouble in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getFirstLocateExpression

public String getFirstLocateExpression(String substring,
                                       String instring)
            throws RdbAdapterException
Specified by:
getFirstLocateExpression in interface RdbAdapter


getFloat

public float getFloat(ResultSet rs,
                      int idx,
                      float nullValue)
            throws SQLException
Get a float value from a ResultSet.
Specified by:
getFloat in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getFromClause

protected void getFromClause(JoinedTable jt,
                             StringBuffer sb)


getFromClause

protected void getFromClause(JoinedTable jtMain,
                             JoinedTable jt,
                             JoinedTable.Join join,
                             StringBuffer sb)


getINCREMENTkeyWord

protected String getINCREMENTkeyWord()


getIndexedLocateExpression

public String getIndexedLocateExpression(String instring,
                                         String substring,
                                         String fromIndex)
            throws RdbAdapterException
Specified by:
getIndexedLocateExpression in interface RdbAdapter


getInt

public int getInt(ResultSet rs,
                  int idx,
                  int nullValue)
            throws SQLException
Get a int value from a ResultSet.
Specified by:
getInt in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getLengthOperator

public String getLengthOperator()
            throws RdbAdapterException
Specified by:
getLengthOperator in interface RdbAdapter


getLong

public long getLong(ResultSet rs,
                    int idx,
                    long nullValue)
            throws SQLException
Get a long value from a ResultSet.
Specified by:
getLong in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getName

public String getName()
Specified by:
getName in interface RdbAdapter


getNextValInSequence

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

Parameters:
seqName - is the sequence name

Returns:
the SQL command to gett a new value in a SQL sequence which the name is given in parameter.


getOboolean

public Boolean getOboolean(ResultSet rs,
                           int idx,
                           Boolean nullValue)
            throws SQLException
Get a Boolean value from a ResultSet.
Specified by:
getOboolean in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getObyte

public Byte getObyte(ResultSet rs,
                     int idx,
                     Byte nullValue)
            throws SQLException
Get a Byte value from a ResultSet.
Specified by:
getObyte in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOchar

public Character getOchar(ResultSet rs,
                          int idx,
                          Character nullValue)
            throws SQLException
Get a Character value from a ResultSet.
Specified by:
getOchar in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOdouble

public Double getOdouble(ResultSet rs,
                         int idx,
                         Double nullValue)
            throws SQLException
Get a Double value from a ResultSet.
Specified by:
getOdouble in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOfloat

public Float getOfloat(ResultSet rs,
                       int idx,
                       Float nullValue)
            throws SQLException
Get a Float value from a ResultSet.
Specified by:
getOfloat in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOint

public Integer getOint(ResultSet rs,
                       int idx,
                       Integer nullValue)
            throws SQLException
Get a Integer value from a ResultSet.
Specified by:
getOint in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOlong

public Long getOlong(ResultSet rs,
                     int idx,
                     Long nullValue)
            throws SQLException
Get a Long value from a ResultSet.
Specified by:
getOlong in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getOshort

public Short getOshort(ResultSet rs,
                       int idx,
                       Short nullValue)
            throws SQLException
Get a Short value from a ResultSet.
Specified by:
getOshort in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getQuery

public String getQuery(String selectClause,
                       List jts,
                       String whereclause,
                       int rangeStart,
                       int rangeSize)
Specified by:
getQuery in interface RdbAdapter


getSTARTkeyWord

protected String getSTARTkeyWord()


getSerialized

public Serializable getSerialized(ResultSet rs,
                                  int idx,
                                  Serializable nullValue)
            throws SQLException,
                   IOException,
                   ClassNotFoundException
Get a Serializable value from a ResultSet.
Specified by:
getSerialized in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getShort

public short getShort(ResultSet rs,
                      int idx,
                      short nullValue)
            throws SQLException
Get a short value from a ResultSet.
Specified by:
getShort in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


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

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.


getSqlTypeCode

public int getSqlTypeCode(int typeCode)
            throws RdbAdapterException
This methods return the SQL type code linked to the java type specified in parameter.
Specified by:
getSqlTypeCode in interface TypeAdapter

Returns:
An int constant defined in the java.sql.Types class


getSqlTypeCode

public int getSqlTypeCode(int typeCode,
                          String sqlColumnType)
            throws RdbAdapterException
This methods return the SQL type code linked to the java type specified in parameter.
Specified by:
getSqlTypeCode in interface TypeAdapter

Returns:
An int constant defined in the java.sql.Types class


getString

public String getString(ResultSet rs,
                        int idx,
                        String nullValue)
            throws SQLException
Get a String value from a ResultSet.
Specified by:
getString in interface ResultsetAdapter

Parameters:
rs - is the result where to get the value
idx - is the index of the value in the resultset
nullValue - represents the nullvalue to return if the column is null in the resultset


getSubqueryAlias

public String getSubqueryAlias()
Specified by:
getSubqueryAlias in interface RdbAdapter


getValueAsSQLString

public String getValueAsSQLString(Object value,
                                  int typeCode)
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

Parameters:
value -
typeCode - is the java type of the value


getValueAsSQLString

public String getValueAsSQLString(boolean value)
This method returns a String value that represents a boolean value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(byte value)
This method returns a String value that represents a byte value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(char value)
This method returns a String value that represents a char value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(double value)
This method returns a String value that represents a double value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(float value)
This method returns a String value that represents a float value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(int value)
This method returns a String value that represents a int value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(long value)
This method returns a String value that represents a long value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getValueAsSQLString

public String getValueAsSQLString(short value)
This method returns a String value that represents a short value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface ValueAsSQLStringAdapter


getWhereClause

protected void getWhereClause(List jts,
                              StringBuffer sb,
                              String whereclause,
                              int rangeStart,
                              int rangeSize)


handleOrderBy

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


modifySelectClauseWithRange

protected void modifySelectClauseWithRange(StringBuffer sb,
                                           int rangeStart,
                                           int rangeSize)


modifyWhereClauseWithRange

protected void modifyWhereClauseWithRange(StringBuffer sb,
                                          String where,
                                          int rangeStart,
                                          int rangeSize)


setBigDecimal

public void setBigDecimal(PreparedStatement ps,
                          int idx,
                          BigDecimal o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setBigDecimal in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setBigInteger

public void setBigInteger(PreparedStatement ps,
                          int idx,
                          BigInteger o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setBigInteger in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setBoolean

public void setBoolean(PreparedStatement ps,
                       int idx,
                       boolean o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setBoolean in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setByte

public void setByte(PreparedStatement ps,
                    int idx,
                    byte o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setByte in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setByteArray

public void setByteArray(PreparedStatement ps,
                         int idx,
                         byte[] o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setByteArray in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setChar

public void setChar(PreparedStatement ps,
                    int idx,
                    char c)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setChar in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement


setCharArray

public void setCharArray(PreparedStatement ps,
                         int idx,
                         char[] o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setCharArray in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setDate

public void setDate(PreparedStatement ps,
                    int idx,
                    Date o,
                    String columnType)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setDate in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setDouble

public void setDouble(PreparedStatement ps,
                      int idx,
                      double o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setDouble in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setFloat

public void setFloat(PreparedStatement ps,
                     int idx,
                     float o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setFloat in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setInt

public void setInt(PreparedStatement ps,
                   int idx,
                   int o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setInt in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setLong

public void setLong(PreparedStatement ps,
                    int idx,
                    long o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setLong in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setNull

public void setNull(PreparedStatement ps,
                    int idx,
                    int sqlType)
            throws SQLException
Assignes a null value into a PreparedStatement
Specified by:
setNull in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
sqlType - is the type of the column


setOboolean

public void setOboolean(PreparedStatement ps,
                        int idx,
                        Boolean o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOboolean in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setObyte

public void setObyte(PreparedStatement ps,
                     int idx,
                     Byte o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setObyte in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOchar

public void setOchar(PreparedStatement ps,
                     int idx,
                     Character o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOchar in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOdouble

public void setOdouble(PreparedStatement ps,
                       int idx,
                       Double o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOdouble in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOfloat

public void setOfloat(PreparedStatement ps,
                      int idx,
                      Float o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOfloat in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOint

public void setOint(PreparedStatement ps,
                    int idx,
                    Integer o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOint in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOlong

public void setOlong(PreparedStatement ps,
                     int idx,
                     Long o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOlong in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setOshort

public void setOshort(PreparedStatement ps,
                      int idx,
                      Short o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setOshort in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setSerialized

public void setSerialized(PreparedStatement ps,
                          int idx,
                          Serializable o)
            throws SQLException,
                   IOException
Assignes a value into a PreparedStatement
Specified by:
setSerialized in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setShort

public void setShort(PreparedStatement ps,
                     int idx,
                     short o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setShort in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


setString

public void setString(PreparedStatement ps,
                      int idx,
                      String o)
            throws SQLException
Assignes a value into a PreparedStatement
Specified by:
setString in interface PreparedStatementAdapter

Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign


sqldate2date

private static Date sqldate2date(java.sql.Date d)


supportBatchPreparedStatement

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


time2date

private static Date time2date(java.sql.Time t)


timestamp2date

private static Date timestamp2date(java.sql.Timestamp tstamp)


writeColumnAlias

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


writeTableAlias

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