org.objectweb.jorm.runtime.mapper.rdb.adapter.lib
Class BasicRdbAdapter

java.lang.Object
  |
  +--org.objectweb.jorm.runtime.mapper.rdb.adapter.lib.BasicRdbAdapter
All Implemented Interfaces:
RdbAdpater
Direct Known Subclasses:
FirebirdAdapter, MckoiAdapter, MysqlAdapter, OracleAdapter, PostgresAdapter, SapdbAdapter, SybaseAdapter

public class BasicRdbAdapter
extends java.lang.Object
implements RdbAdpater


Constructor Summary
BasicRdbAdapter()
           
 
Method Summary
 int fetchResultSetSize(java.sql.ResultSet rs)
          This calculates the size of a result set.
 java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs, int idx)
           
 boolean getBoolean(java.sql.ResultSet rs, int idx)
           
 byte getByte(java.sql.ResultSet rs, int idx)
           
 byte[] getByteArray(java.sql.ResultSet rs, int idx)
           
 char getChar(java.sql.ResultSet rs, int idx)
           
 char[] getCharArray(java.sql.ResultSet rs, int idx)
           
 java.util.Date getDate(java.sql.ResultSet rs, int idx)
           
 double getDouble(java.sql.ResultSet rs, int idx)
           
 float getFloat(java.sql.ResultSet rs, int idx)
           
 int getInt(java.sql.ResultSet rs, int idx)
           
 long getLong(java.sql.ResultSet rs, int idx)
           
 java.lang.Object getObject(java.sql.ResultSet rs, int idx)
           
 java.lang.Boolean getOboolean(java.sql.ResultSet rs, int idx)
           
 java.lang.Byte getObyte(java.sql.ResultSet rs, int idx)
           
 java.lang.Character getOchar(java.sql.ResultSet rs, int idx)
           
 java.lang.Double getOdouble(java.sql.ResultSet rs, int idx)
           
 java.lang.Float getOfloat(java.sql.ResultSet rs, int idx)
           
 java.lang.Integer getOint(java.sql.ResultSet rs, int idx)
           
 java.lang.Long getOlong(java.sql.ResultSet rs, int idx)
           
 java.lang.Short getOshort(java.sql.ResultSet rs, int idx)
           
 short getShort(java.sql.ResultSet rs, int idx)
           
 java.lang.String getSqlGetterName(PType pt, java.lang.String resultSet, int idx)
          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)
          This method returns the sql setter method associated to the PType specified in parameter.
 java.lang.String getSqlType(PType pt, boolean usedInPK)
          This method returns the SQL type linked to the PType specified in parameter.
 int getSqlTypeCode(PType pt)
          This methods return the SQL type code linked to the PType specified in parameter.
 java.lang.String getString(java.sql.ResultSet rs, int idx)
           
 java.lang.String getValueAsSQLString(boolean value)
          This method returns a String value that represents a boolean value.
 java.lang.String getValueAsSQLString(byte value)
          This method returns a String value that represents a byte value.
 java.lang.String getValueAsSQLString(char value)
          This method returns a String value that represents a char value.
 java.lang.String getValueAsSQLString(double value)
          This method returns a String value that represents a double value.
 java.lang.String getValueAsSQLString(float value)
          This method returns a String value that represents a float value.
 java.lang.String getValueAsSQLString(int value)
          This method returns a String value that represents a int value.
 java.lang.String getValueAsSQLString(long value)
          This method returns a String value that represents a long value.
 java.lang.String getValueAsSQLString(java.lang.Object value, PType type)
          This method returns a String value that represents a value.
 java.lang.String getValueAsSQLString(short value)
          This method returns a String value that represents a short value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicRdbAdapter

public BasicRdbAdapter()
Method Detail

getSqlTypeCode

public int getSqlTypeCode(PType pt)
                   throws PExceptionProtocol
This methods return the SQL type code linked to the PType specified in parameter.
Specified by:
getSqlTypeCode in interface RdbAdpater
Returns:
An int constant defined in the java.sql.Types class

getSqlType

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

getSqlGetterName

public java.lang.String getSqlGetterName(PType pt,
                                         java.lang.String resultSet,
                                         int idx)
                                  throws PExceptionProtocol
Description copied from interface: RdbAdpater
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 RdbAdpater

getSqlSetterName

public java.lang.String getSqlSetterName(PType pt,
                                         java.lang.String value,
                                         int idx)
                                  throws PExceptionProtocol
Description copied from interface: RdbAdpater
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 RdbAdpater

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 RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(java.lang.Object value,
                                            PType type)
Description copied from interface: RdbAdpater
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 RdbAdpater
Following copied from interface: org.objectweb.jorm.runtime.mapper.rdb.adapter.api.RdbAdpater
Parameters:
value -  
type - is the PType of the @value

getValueAsSQLString

public java.lang.String getValueAsSQLString(boolean value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a boolean value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(byte value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a byte value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(char value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a char value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(short value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a short value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(int value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a int value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(long value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a long value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(float value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a float value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getValueAsSQLString

public java.lang.String getValueAsSQLString(double value)
Description copied from interface: RdbAdpater
This method returns a String value that represents a double value. This method can be used for the constant parameters of SQL queries.
Specified by:
getValueAsSQLString in interface RdbAdpater

getBoolean

public boolean getBoolean(java.sql.ResultSet rs,
                          int idx)
                   throws java.sql.SQLException
Specified by:
getBoolean in interface RdbAdpater

getOboolean

public java.lang.Boolean getOboolean(java.sql.ResultSet rs,
                                     int idx)
                              throws java.sql.SQLException
Specified by:
getOboolean in interface RdbAdpater

getChar

public char getChar(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Specified by:
getChar in interface RdbAdpater

getOchar

public java.lang.Character getOchar(java.sql.ResultSet rs,
                                    int idx)
                             throws java.sql.SQLException
Specified by:
getOchar in interface RdbAdpater

getByte

public byte getByte(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Specified by:
getByte in interface RdbAdpater

getObyte

public java.lang.Byte getObyte(java.sql.ResultSet rs,
                               int idx)
                        throws java.sql.SQLException
Specified by:
getObyte in interface RdbAdpater

getShort

public short getShort(java.sql.ResultSet rs,
                      int idx)
               throws java.sql.SQLException
Specified by:
getShort in interface RdbAdpater

getOshort

public java.lang.Short getOshort(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Specified by:
getOshort in interface RdbAdpater

getInt

public int getInt(java.sql.ResultSet rs,
                  int idx)
           throws java.sql.SQLException
Specified by:
getInt in interface RdbAdpater

getOint

public java.lang.Integer getOint(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Specified by:
getOint in interface RdbAdpater

getLong

public long getLong(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Specified by:
getLong in interface RdbAdpater

getOlong

public java.lang.Long getOlong(java.sql.ResultSet rs,
                               int idx)
                        throws java.sql.SQLException
Specified by:
getOlong in interface RdbAdpater

getFloat

public float getFloat(java.sql.ResultSet rs,
                      int idx)
               throws java.sql.SQLException
Specified by:
getFloat in interface RdbAdpater

getOfloat

public java.lang.Float getOfloat(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Specified by:
getOfloat in interface RdbAdpater

getDouble

public double getDouble(java.sql.ResultSet rs,
                        int idx)
                 throws java.sql.SQLException
Specified by:
getDouble in interface RdbAdpater

getOdouble

public java.lang.Double getOdouble(java.sql.ResultSet rs,
                                   int idx)
                            throws java.sql.SQLException
Specified by:
getOdouble in interface RdbAdpater

getString

public java.lang.String getString(java.sql.ResultSet rs,
                                  int idx)
                           throws java.sql.SQLException
Specified by:
getString in interface RdbAdpater

getDate

public java.util.Date getDate(java.sql.ResultSet rs,
                              int idx)
                       throws java.sql.SQLException
Specified by:
getDate in interface RdbAdpater

getCharArray

public char[] getCharArray(java.sql.ResultSet rs,
                           int idx)
                    throws java.sql.SQLException
Specified by:
getCharArray in interface RdbAdpater

getByteArray

public byte[] getByteArray(java.sql.ResultSet rs,
                           int idx)
                    throws java.sql.SQLException
Specified by:
getByteArray in interface RdbAdpater

getObject

public java.lang.Object getObject(java.sql.ResultSet rs,
                                  int idx)
                           throws java.sql.SQLException
Specified by:
getObject in interface RdbAdpater

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs,
                                          int idx)
                                   throws java.sql.SQLException
Specified by:
getBigDecimal in interface RdbAdpater