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

java.lang.Object
  extended byorg.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
      extended byorg.objectweb.jorm.mapper.rdb.adapter.MysqlAdapter
All Implemented Interfaces:
RdbAdapter

public class MysqlAdapter
extends BasicRdbAdapter

MySql 4.0.12

Author:
S.Chassande-Barrioz

Field Summary
 int varbinarySize
           
 int varbinarySizeInPk
           
 
Constructor Summary
MysqlAdapter()
           
 
Method Summary
 int fetchResultSetSize(java.sql.ResultSet rs)
          This calculates the size of a result set.
 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 getSqlGetterName(PType pt, java.lang.String resultSet, int idx, java.lang.String sql)
          This method returns the sql getter method associated to the PType specified in parameter.
 java.lang.String getSqlSetterName(PType pt, java.lang.String value, int idx, java.lang.String sqlColumnType)
          This method returns the sql setter method associated to the PType specified in parameter.
 java.lang.String getSqlType(PType pt, boolean usedInPK, int size)
          This method returns the SQL type linked to the PType specified in parameter.
 int getSqlTypeCode(PType pt, java.lang.String sqlColumnType)
          This methods return the SQL type code linked to the PType specified in parameter.
 void setDate(java.sql.PreparedStatement ps, int idx, java.util.Date o, java.lang.String columnType)
           
 void setVarcharSize(int s)
           
 void setVarcharSizeInPk(int s)
           
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
existSequence, existTable, getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getChar, getCharArray, getCharArray, getConcatExpression, getCreateSequence, getDate, getDate, getDouble, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getInt, getLong, getNextValInSequence, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getSerialized, getShort, getSqlGetterName, getSqlSetterName, getSqlTypeCode, getString, getSubqueryAlias, getSubstringName, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getWhereClause, handleOrderBy, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setCharArray, setDouble, setFloat, setInt, setLong, setOboolean, setObyte, setOchar, setOdouble, setOfloat, setOint, setOlong, setOshort, setSerialized, setShort, setString, writeTableAlias
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

varbinarySize

public int varbinarySize

varbinarySizeInPk

public int varbinarySizeInPk
Constructor Detail

MysqlAdapter

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

fetchResultSetSize

public int fetchResultSetSize(java.sql.ResultSet rs)
                       throws java.sql.SQLException
This calculates the size of a result set. If this feature is not supported by a database or its jdbc driver, this method returns -1.

Specified by:
fetchResultSetSize in interface RdbAdapter
Overrides:
fetchResultSetSize in class BasicRdbAdapter
Parameters:
rs - the result set which the size must be returned
Throws:
java.sql.SQLException

setVarcharSize

public void setVarcharSize(int s)

setVarcharSizeInPk

public void setVarcharSizeInPk(int s)

getSqlType

public java.lang.String getSqlType(PType pt,
                                   boolean usedInPK,
                                   int size)
                            throws PExceptionProtocol
Description copied from interface: RdbAdapter
This method returns the SQL type linked to the PType specified in parameter.

Specified by:
getSqlType in interface RdbAdapter
Overrides:
getSqlType in class BasicRdbAdapter
Throws:
PExceptionProtocol

getSqlTypeCode

public int getSqlTypeCode(PType pt,
                          java.lang.String sqlColumnType)
                   throws PExceptionProtocol
Description copied from class: BasicRdbAdapter
This methods return the SQL type code linked to the PType specified in parameter.

Specified by:
getSqlTypeCode in interface RdbAdapter
Overrides:
getSqlTypeCode in class BasicRdbAdapter
Returns:
An int constant defined in the java.sql.Types class
Throws:
PExceptionProtocol

getSqlGetterName

public java.lang.String getSqlGetterName(PType pt,
                                         java.lang.String resultSet,
                                         int idx,
                                         java.lang.String sql)
                                  throws PExceptionProtocol
Description copied from interface: RdbAdapter
This method returns the sql getter method associated to the PType specified in parameter. The returned string is the fetching of the value on the resultset to the specified index: "@resultSet.getBoolean(@idx)"

Specified by:
getSqlGetterName in interface RdbAdapter
Overrides:
getSqlGetterName in class BasicRdbAdapter
Throws:
PExceptionProtocol

getSqlSetterName

public java.lang.String getSqlSetterName(PType pt,
                                         java.lang.String value,
                                         int idx,
                                         java.lang.String sqlColumnType)
                                  throws PExceptionProtocol
Description copied from interface: RdbAdapter
This method returns the sql setter method associated to the PType specified in parameter. The returned string is the assignment of the value to the specified index: "setBoolean(@idx, @value)"

Specified by:
getSqlSetterName in interface RdbAdapter
Overrides:
getSqlSetterName in class BasicRdbAdapter
Throws:
PExceptionProtocol

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

setDate

public void setDate(java.sql.PreparedStatement ps,
                    int idx,
                    java.util.Date o,
                    java.lang.String columnType)
             throws java.sql.SQLException
Specified by:
setDate in interface RdbAdapter
Overrides:
setDate in class BasicRdbAdapter
Throws:
java.sql.SQLException