org.objectweb.jorm.mapper.rdb.adapter

Class SqlserverAdapter

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

public class SqlserverAdapter
extends BasicRdbAdapter

This class is a sql adapter for the SQL Server relational database.

Author:
P. Dechamboux

Field Summary

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

SqlserverAdapter()

Method Summary

char[]
getCharArray(ResultSet rs, int idx, char[] nullValue)
Get a char[] value from a ResultSet.
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
getLengthOperator()
String
getSqlType(int typeCode, boolean usedInPK, int size, int scale)
This method returns the SQL type linked to the java type
void
setCharArray(PreparedStatement ps, int idx, char[] 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

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

Constructor Details

SqlserverAdapter

public SqlserverAdapter()

Method Details

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

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


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 -


getLengthOperator

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

Returns:
the name of the length operator


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.


setCharArray

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

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

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

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