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

java.lang.Object
  extended by org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
      extended by org.objectweb.jorm.mapper.rdb.adapter.HsqlAdapter
All Implemented Interfaces:
PreparedStatementAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter

public class HsqlAdapter
extends BasicRdbAdapter

RdbAdapter for the Hsql Database.

Author:
S.Chassande-Barrioz

Field Summary
 
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
HsqlAdapter()
           
 
Method Summary
protected  boolean existRelation(java.sql.Connection connection, java.lang.String tableName, java.lang.String[] relationTypes)
           
 boolean existSequence(java.sql.Connection connection, java.lang.String seqName)
          checks the sequence existence
 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.
 void getManyNextValInSequence(java.sql.Connection conn, java.lang.String seqName, int numberOfNextVal)
           
 java.lang.String getNextValInSequence(java.lang.String seqName)
           
 int getRangeParametersAtStart()
          Indicates whether parameters corresponding to range queries (range start and size) are positioned at the start or at the end of the SQL query.
protected  void modifyQueryWithRange(java.lang.StringBuffer sb, boolean rangeStart, boolean rangeSize)
           
protected  void modifySelectClauseWithRange(java.lang.StringBuffer sb, boolean rangeStart, boolean rangeSize)
           
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 
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, getColumnAliasExpr, getConcatExpression, getCreateSequence, getCreateSequence, getDate, getDate, getDouble, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getFromClause, getINCREMENTkeyWord, getInt, getLengthOperator, getLong, getName, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getQuery, getSerialized, getShort, getSqlType, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, getSubqueryAlias, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, handleOrderBy, 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, writeColumnAlias, writeTableAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HsqlAdapter

public HsqlAdapter()
Method Detail

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

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.

existRelation

protected boolean existRelation(java.sql.Connection connection,
                                java.lang.String tableName,
                                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
Parameters:
connection - is the JDBC connection to use
seqName - is the sequence of the table
Returns:
true if the table exists, otherwise false.
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
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.

getManyNextValInSequence

public void getManyNextValInSequence(java.sql.Connection conn,
                                     java.lang.String seqName,
                                     int numberOfNextVal)
                              throws RdbAdapterException
Specified by:
getManyNextValInSequence in interface SequenceAdapter
Overrides:
getManyNextValInSequence in class BasicRdbAdapter
seqName - the sequence name
numberOfNextVal - the number of next val called in the same query
Throws:
RdbAdapterException

modifySelectClauseWithRange

protected void modifySelectClauseWithRange(java.lang.StringBuffer sb,
                                           boolean rangeStart,
                                           boolean rangeSize)
Overrides:
modifySelectClauseWithRange in class BasicRdbAdapter

modifyQueryWithRange

protected void modifyQueryWithRange(java.lang.StringBuffer sb,
                                    boolean rangeStart,
                                    boolean rangeSize)
Overrides:
modifyQueryWithRange in class BasicRdbAdapter

getRangeParametersAtStart

public int getRangeParametersAtStart()
Description copied from interface: RdbAdapter
Indicates whether parameters corresponding to range queries (range start and size) are positioned at the start or at the end of the SQL query.

Indeed, depending on the database, the SQL syntax may vary, and the parameters can either be put at the front or at the end.

Specified by:
getRangeParametersAtStart in interface RdbAdapter
Overrides:
getRangeParametersAtStart in class BasicRdbAdapter
Returns:
RANGEATSTART if the parameters are at the start, RANGEATEND if they are at the end, RANGEUNSUPPORTED if range queries are not supported by the adapter.