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

java.lang.Object
  extended by org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
      extended by org.objectweb.jorm.mapper.rdb.adapter.SqlserverAdapter
All 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
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
SqlserverAdapter()
           
 
Method Summary
 char[] getCharArray(java.sql.ResultSet rs, int idx, char[] nullValue)
          Get a char[] value from a ResultSet.
 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 getLengthOperator()
           
 java.lang.String getSqlType(int typeCode, boolean usedInPK, int size, int scale)
          This method returns the SQL type linked to the java type
 void setCharArray(java.sql.PreparedStatement ps, int idx, char[] o)
          Assignes a char[] value into a PreparedStatement
 void setObyte(java.sql.PreparedStatement ps, int idx, java.lang.Byte o)
          Assignes a Byte value into a PreparedStatement
 void setOchar(java.sql.PreparedStatement ps, int idx, java.lang.Character o)
          Assignes a Character value into a PreparedStatement
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
appendClause, escapeFunctionClose, escapeFunctionOpen, existRelation, existSequence, existTable, existView, fetchResultSetSize, getArray, getArrayElementAsSQLString, getArrayToString, getArrayToStringBegin, getArrayToStringEnd, getArrayToStringSeparator, getArrayValueAsSQLString, getArrayValueAsSQLString, getArrayValueAsSQLStringBegin, getArrayValueAsSQLStringEnd, getArrayValueAsSQLStringSeparator, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getColumnAliasExpr, getConcatExpression, getDate, getDate, getDouble, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getFromClause, getINCREMENTkeyWord, getIndexedLocateExpression, getInt, getLong, getManyNextValInSequence, getName, getNextValInSequence, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getQuery, getRangeParametersAtStart, getSerialized, getShort, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, getSubqueryAlias, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, handleOrderBy, modifyQueryWithRange, modifySelectClauseWithRange, setArray, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setDate, setDouble, setFloat, setInt, setLogger, setLong, setNull, setOboolean, setOdouble, setOfloat, setOint, setOlong, setOshort, setSerialized, setShort, setString, supportArray, supportBatchPreparedStatement, writeColumnAlias, writeTableAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlserverAdapter

public SqlserverAdapter()
Method Detail

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

getCharArray

public char[] getCharArray(java.sql.ResultSet rs,
                           int idx,
                           char[] nullValue)
                    throws java.sql.SQLException
Description copied from interface: ResultsetAdapter
Get a char[] value from a ResultSet.

Specified by:
getCharArray in interface ResultsetAdapter
Overrides:
getCharArray in class 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
Throws:
java.sql.SQLException

setObyte

public void setObyte(java.sql.PreparedStatement ps,
                     int idx,
                     java.lang.Byte o)
              throws java.sql.SQLException
Description copied from interface: PreparedStatementAdapter
Assignes a Byte value into a PreparedStatement

Specified by:
setObyte in interface PreparedStatementAdapter
Overrides:
setObyte in class BasicRdbAdapter
Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign
Throws:
java.sql.SQLException

setOchar

public void setOchar(java.sql.PreparedStatement ps,
                     int idx,
                     java.lang.Character o)
              throws java.sql.SQLException
Description copied from interface: PreparedStatementAdapter
Assignes a Character value into a PreparedStatement

Specified by:
setOchar in interface PreparedStatementAdapter
Overrides:
setOchar in class BasicRdbAdapter
Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign
Throws:
java.sql.SQLException

setCharArray

public void setCharArray(java.sql.PreparedStatement ps,
                         int idx,
                         char[] o)
                  throws java.sql.SQLException
Description copied from interface: PreparedStatementAdapter
Assignes a char[] value into a PreparedStatement

Specified by:
setCharArray in interface PreparedStatementAdapter
Overrides:
setCharArray in class BasicRdbAdapter
Parameters:
ps - is the PreparedStatement
idx - is the index of the the value in the PreparedStatement
o - is the value to assign
Throws:
java.sql.SQLException

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

getLengthOperator

public java.lang.String getLengthOperator()
                                   throws RdbAdapterException
Specified by:
getLengthOperator in interface RdbAdapter
Overrides:
getLengthOperator in class BasicRdbAdapter
Returns:
the name of the length operator
Throws:
RdbAdapterException