org.objectweb.jorm.mapper.rdb.adapter

Class CloudscapeAdapter

Implemented Interfaces:
PreparedStatementAdapter, RdbAdapter, RdbAdapter, ResultsetAdapter, SequenceAdapter, TypeAdapter, ValueAsSQLStringAdapter

public class CloudscapeAdapter
extends BasicRdbAdapter

Author:
Tom Lane

Field Summary

private static String
CLOUDSCAPECONCAT
private static String
CLOUDSCAPEFIRSTLOCATE
private static String
CLOUDSCAPESUBSTRING

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

CloudscapeAdapter()

Method Summary

protected boolean
existRelation(Connection connection, String relName, String[] relationTypes)
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 ]
String
getFirstLocateExpression(String substring, String instring)
Returns the expression for searching the position of the first occurrence of a substring in a string.
String
getIndexedLocateExpression(String instring, String substring, String fromIndex)
Returns the expression for searching the position of the first occurrence of a substring in a string starting from a given index.
String
getSqlType(int typeCode, boolean usedInPK, int size, int scale)
This method returns the SQL type linked to the java type
String
getSubqueryAlias()
In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.
String
getSubstringName()
String
getValueAsSQLString(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

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

CLOUDSCAPECONCAT

private static final String CLOUDSCAPECONCAT


CLOUDSCAPEFIRSTLOCATE

private static final String CLOUDSCAPEFIRSTLOCATE


CLOUDSCAPESUBSTRING

private static final String CLOUDSCAPESUBSTRING

Constructor Details

CloudscapeAdapter

public CloudscapeAdapter()

Method Details

existRelation

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


getConcatExpression

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

Returns:
the use of the concat operator between two strings


getCreateSequence

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

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)
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 interface BasicRdbAdapter

Parameters:
seqName -
startid -
inc -


getFirstLocateExpression

public String getFirstLocateExpression(String substring,
                                       String instring)
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 interface BasicRdbAdapter

Parameters:
substring - The substring searched
instring - The string in which to search the substring

Returns:
The corresponding relational expression.


getIndexedLocateExpression

public String getIndexedLocateExpression(String instring,
                                         String substring,
                                         String fromIndex)
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 interface BasicRdbAdapter

Parameters:
substring - The substring searched
fromIndex - The index from which to start searching

Returns:
The corresponding relational expression.


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.


getSubqueryAlias

public String getSubqueryAlias()
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 interface BasicRdbAdapter

Returns:
the String to be appended to the subquery


getSubstringName

public String getSubstringName()


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
Overrides:
getValueAsSQLString in interface BasicRdbAdapter

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


supportBatchPreparedStatement

public boolean supportBatchPreparedStatement()
Indicates if the driver supports the batch of PreparedStatement
Specified by:
supportBatchPreparedStatement in interface RdbAdapter
Overrides:
supportBatchPreparedStatement in interface BasicRdbAdapter