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

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

public class CloudscapeAdapter
extends BasicRdbAdapter

Author:
Tom Lane

Field Summary
private static java.lang.String CLOUDSCAPECONCAT
           
private static java.lang.String CLOUDSCAPEFIRSTLOCATE
           
private static java.lang.String CLOUDSCAPESUBSTRING
           
 
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
CloudscapeAdapter()
           
 
Method Summary
protected  boolean existRelation(java.sql.Connection connection, java.lang.String relName, java.lang.String[] relationTypes)
           
 java.lang.String getConcatExpression(java.lang.String op1, java.lang.String op2)
           
 java.lang.String getCreateSequence(java.lang.String seqName)
           
 java.lang.String getCreateSequence(java.lang.String seqName, java.lang.Integer startid, java.lang.Integer inc, java.lang.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 ]
 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 getSqlType(int typeCode, boolean usedInPK, int size, int scale)
          This method returns the SQL type linked to the java type
 java.lang.String getSubqueryAlias()
          In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.
 java.lang.String getSubstringName()
           
 java.lang.String getValueAsSQLString(java.lang.Object value, int typeCode)
          This method returns a String value that represents a value.
 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, existSequence, existTable, existView, fetchResultSetSize, getArray, getArrayElementAsSQLString, getArrayToString, getArrayToStringBegin, getArrayToStringEnd, getArrayToStringSeparator, getArrayValueAsSQLString, getArrayValueAsSQLString, getArrayValueAsSQLStringBegin, getArrayValueAsSQLStringEnd, getArrayValueAsSQLStringSeparator, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getCharArray, getColumnAliasExpr, getDate, getDate, getDouble, getFloat, getFromClause, getFromClause, getFromClause, getINCREMENTkeyWord, getInt, getLengthOperator, getLong, getManyNextValInSequence, getName, getNextValInSequence, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getQuery, getRangeParametersAtStart, getSerialized, getShort, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, 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, writeColumnAlias, writeTableAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOUDSCAPESUBSTRING

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

CLOUDSCAPECONCAT

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

CLOUDSCAPEFIRSTLOCATE

private static final java.lang.String CLOUDSCAPEFIRSTLOCATE
See Also:
Constant Field Values
Constructor Detail

CloudscapeAdapter

public CloudscapeAdapter()
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

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
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.
Throws:
RdbAdapterException

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
typeCode - is the java type of the value

getSubstringName

public java.lang.String getSubstringName()

getConcatExpression

public java.lang.String getConcatExpression(java.lang.String op1,
                                            java.lang.String op2)
Specified by:
getConcatExpression in interface RdbAdapter
Overrides:
getConcatExpression in class BasicRdbAdapter
Returns:
the use of the concat operator between two strings

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.

Three main syntaxes are found: position(substr in str), locate(substr, srt) and instr(str, substr).

Specified by:
getFirstLocateExpression in interface RdbAdapter
Overrides:
getFirstLocateExpression in class BasicRdbAdapter
Parameters:
substring - The substring searched
instring - The string in which to search the substring
Returns:
The corresponding relational expression.

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 relName,
                                java.lang.String[] relationTypes)
                         throws java.sql.SQLException
Overrides:
existRelation in class BasicRdbAdapter
Throws:
java.sql.SQLException

getSubqueryAlias

public java.lang.String getSubqueryAlias()
Description copied from interface: RdbAdapter
In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.

Specified by:
getSubqueryAlias in interface RdbAdapter
Overrides:
getSubqueryAlias in class BasicRdbAdapter
Returns:
the String to be appended to the subquery

getCreateSequence

public java.lang.String getCreateSequence(java.lang.String seqName)
                                   throws java.lang.UnsupportedOperationException
Specified by:
getCreateSequence in interface SequenceAdapter
Overrides:
getCreateSequence in class BasicRdbAdapter
Parameters:
seqName - is the sequence name
Returns:
the SQL command to create a sequence
Throws:
java.lang.UnsupportedOperationException

getCreateSequence

public java.lang.String getCreateSequence(java.lang.String seqName,
                                          java.lang.Integer startid,
                                          java.lang.Integer inc,
                                          java.lang.Integer cache)
Description copied from class: BasicRdbAdapter
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
Overrides:
getCreateSequence in class BasicRdbAdapter
Parameters:
seqName - is the sequence name
startid - is the initial value of the sequence
inc - is the increment size
cache - is the size of the cache
Returns:
the SQL command to create a sequence