org.objectweb.jorm.mapper.rdb.adapter
Interface RdbAdapter

All Known Implementing Classes:
BasicRdbAdapter

public interface RdbAdapter


Method Summary
 boolean existSequence(java.sql.Connection connection, java.lang.String seqName)
           
 boolean existTable(java.sql.Connection connection, java.lang.String tableName)
           
 int fetchResultSetSize(java.sql.ResultSet rs)
          This method 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.lang.String getConcatExpression(java.lang.String op1, java.lang.String op2)
           
 java.lang.String getCreateSequence(java.lang.String seqName)
           
 java.lang.String getCreateSequence(java.lang.String seqName, java.lang.Integer startid, java.lang.Integer increment, java.lang.Integer cache)
           
 java.util.Date getDate(java.sql.ResultSet rs, int idx)
           
 java.util.Date getDate(java.sql.ResultSet rs, int idx, java.lang.String sqlColumnType)
           
 double getDouble(java.sql.ResultSet rs, int idx)
           
 java.lang.String getFirstLocateExpression(java.lang.String substring, java.lang.String instring)
          Returns the expression for searching the position of the first occurrence of a substring in a string.
 float getFloat(java.sql.ResultSet rs, int idx)
           
 java.lang.String getIndexedLocateExpression(java.lang.String inputString, 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.
 int getInt(java.sql.ResultSet rs, int idx)
           
 long getLong(java.sql.ResultSet rs, int idx)
           
 java.lang.String getNextValInSequence(java.lang.String seqName)
           
 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)
           
 java.lang.String getQuery(java.lang.String selectClause, java.util.List jts, java.lang.String whereclause)
           
 java.io.Serializable getSerialized(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 getSqlGetterName(PType pt, java.lang.String resultSet, int idx, java.lang.String sqlColumnType)
          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 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)
          This method returns the SQL type code linked to the PType specified in parameter.
 int getSqlTypeCode(PType pt, java.lang.String sqlColumnType)
          This method returns the SQL type code linked to the PType specified in parameter.
 java.lang.String getString(java.sql.ResultSet rs, int idx)
           
 java.lang.String getSubqueryAlias()
          In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.
 java.lang.String getSubstringName()
           
 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.
 java.lang.String handleOrderBy(java.lang.String query)
           
 void setBigDecimal(java.sql.PreparedStatement ps, int idx, java.math.BigDecimal o)
           
 void setBoolean(java.sql.PreparedStatement ps, int idx, boolean o)
           
 void setByte(java.sql.PreparedStatement ps, int idx, byte b)
           
 void setByteArray(java.sql.PreparedStatement ps, int idx, byte[] o)
           
 void setChar(java.sql.PreparedStatement ps, int idx, char c)
           
 void setCharArray(java.sql.PreparedStatement ps, int idx, char[] o)
           
 void setDate(java.sql.PreparedStatement ps, int idx, java.util.Date o, java.lang.String columnType)
           
 void setDouble(java.sql.PreparedStatement ps, int idx, double o)
           
 void setFloat(java.sql.PreparedStatement ps, int idx, float o)
           
 void setInt(java.sql.PreparedStatement ps, int idx, int o)
           
 void setLong(java.sql.PreparedStatement ps, int idx, long o)
           
 void setOboolean(java.sql.PreparedStatement ps, int idx, java.lang.Boolean o)
           
 void setObyte(java.sql.PreparedStatement ps, int idx, java.lang.Byte o)
           
 void setOchar(java.sql.PreparedStatement ps, int idx, java.lang.Character o)
           
 void setOdouble(java.sql.PreparedStatement ps, int idx, java.lang.Double o)
           
 void setOfloat(java.sql.PreparedStatement ps, int idx, java.lang.Float o)
           
 void setOint(java.sql.PreparedStatement ps, int idx, java.lang.Integer o)
           
 void setOlong(java.sql.PreparedStatement ps, int idx, java.lang.Long o)
           
 void setOshort(java.sql.PreparedStatement ps, int idx, java.lang.Short o)
           
 void setSerialized(java.sql.PreparedStatement ps, int idx, java.io.Serializable o)
           
 void setShort(java.sql.PreparedStatement ps, int idx, short o)
           
 void setString(java.sql.PreparedStatement ps, int idx, java.lang.String o)
           
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 void writeTableAlias(java.lang.String alias, java.lang.StringBuffer sb)
          Used to write table aliases, for which the syntax may vary (use of 'as', except for Oracle)
 

Method Detail

getSqlType

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

Throws:
PExceptionProtocol

getSqlGetterName

public java.lang.String getSqlGetterName(PType pt,
                                         java.lang.String resultSet,
                                         int idx)
                                  throws PExceptionProtocol
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)"

Throws:
PExceptionProtocol

getSqlGetterName

public java.lang.String getSqlGetterName(PType pt,
                                         java.lang.String resultSet,
                                         int idx,
                                         java.lang.String sqlColumnType)
                                  throws PExceptionProtocol
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)"

Throws:
PExceptionProtocol

getSqlSetterName

public java.lang.String getSqlSetterName(PType pt,
                                         java.lang.String value,
                                         int idx)
                                  throws PExceptionProtocol
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)"

Throws:
PExceptionProtocol

getSqlSetterName

public java.lang.String getSqlSetterName(PType pt,
                                         java.lang.String value,
                                         int idx,
                                         java.lang.String sqlColumnType)
                                  throws PExceptionProtocol
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)"

Throws:
PExceptionProtocol

supportBatchPreparedStatement

public boolean supportBatchPreparedStatement()
Indicates if the driver supports the batch of PreparedStatement


getValueAsSQLString

public java.lang.String getValueAsSQLString(java.lang.Object value,
                                            PType type)
This method returns a String value that represents a value. This method can be used for the constant parameters of SQL queries.

Parameters:
value -
type - is the PType of the @value

getValueAsSQLString

public java.lang.String getValueAsSQLString(boolean value)
This method returns a String value that represents a boolean value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(byte value)
This method returns a String value that represents a byte value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(char value)
This method returns a String value that represents a char value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(short value)
This method returns a String value that represents a short value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(int value)
This method returns a String value that represents a int value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(long value)
This method returns a String value that represents a long value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(float value)
This method returns a String value that represents a float value. This method can be used for the constant parameters of SQL queries.


getValueAsSQLString

public java.lang.String getValueAsSQLString(double value)
This method returns a String value that represents a double value. This method can be used for the constant parameters of SQL queries.


getSqlTypeCode

public int getSqlTypeCode(PType pt)
                   throws PExceptionProtocol
This method returns the SQL type code linked to the PType specified in parameter.

Returns:
An int constant defined in the java.sql.Types class
Throws:
PExceptionProtocol

getSqlTypeCode

public int getSqlTypeCode(PType pt,
                          java.lang.String sqlColumnType)
                   throws PExceptionProtocol
This method returns the SQL type code linked to the PType specified in parameter.

Returns:
An int constant defined in the java.sql.Types class
Throws:
PExceptionProtocol

fetchResultSetSize

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

Parameters:
rs - the result set which the size must be returned
Throws:
java.sql.SQLException

getBoolean

public boolean getBoolean(java.sql.ResultSet rs,
                          int idx)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getOboolean

public java.lang.Boolean getOboolean(java.sql.ResultSet rs,
                                     int idx)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getChar

public char getChar(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

getOchar

public java.lang.Character getOchar(java.sql.ResultSet rs,
                                    int idx)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getByte

public byte getByte(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

getObyte

public java.lang.Byte getObyte(java.sql.ResultSet rs,
                               int idx)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getShort

public short getShort(java.sql.ResultSet rs,
                      int idx)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

getOshort

public java.lang.Short getOshort(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getInt

public int getInt(java.sql.ResultSet rs,
                  int idx)
           throws java.sql.SQLException
Throws:
java.sql.SQLException

getOint

public java.lang.Integer getOint(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getLong

public long getLong(java.sql.ResultSet rs,
                    int idx)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

getOlong

public java.lang.Long getOlong(java.sql.ResultSet rs,
                               int idx)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getFloat

public float getFloat(java.sql.ResultSet rs,
                      int idx)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

getOfloat

public java.lang.Float getOfloat(java.sql.ResultSet rs,
                                 int idx)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getDouble

public double getDouble(java.sql.ResultSet rs,
                        int idx)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getOdouble

public java.lang.Double getOdouble(java.sql.ResultSet rs,
                                   int idx)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getString

public java.lang.String getString(java.sql.ResultSet rs,
                                  int idx)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getDate

public java.util.Date getDate(java.sql.ResultSet rs,
                              int idx)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getDate

public java.util.Date getDate(java.sql.ResultSet rs,
                              int idx,
                              java.lang.String sqlColumnType)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs,
                                          int idx)
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getCharArray

public char[] getCharArray(java.sql.ResultSet rs,
                           int idx)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getByteArray

public byte[] getByteArray(java.sql.ResultSet rs,
                           int idx)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getSerialized

public java.io.Serializable getSerialized(java.sql.ResultSet rs,
                                          int idx)
                                   throws java.sql.SQLException,
                                          java.io.IOException,
                                          java.lang.ClassNotFoundException
Throws:
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException

setBoolean

public void setBoolean(java.sql.PreparedStatement ps,
                       int idx,
                       boolean o)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

setOboolean

public void setOboolean(java.sql.PreparedStatement ps,
                        int idx,
                        java.lang.Boolean o)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

setChar

public void setChar(java.sql.PreparedStatement ps,
                    int idx,
                    char c)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

setOchar

public void setOchar(java.sql.PreparedStatement ps,
                     int idx,
                     java.lang.Character o)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setByte

public void setByte(java.sql.PreparedStatement ps,
                    int idx,
                    byte b)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

setObyte

public void setObyte(java.sql.PreparedStatement ps,
                     int idx,
                     java.lang.Byte o)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setShort

public void setShort(java.sql.PreparedStatement ps,
                     int idx,
                     short o)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setOshort

public void setOshort(java.sql.PreparedStatement ps,
                      int idx,
                      java.lang.Short o)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

setInt

public void setInt(java.sql.PreparedStatement ps,
                   int idx,
                   int o)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

setOint

public void setOint(java.sql.PreparedStatement ps,
                    int idx,
                    java.lang.Integer o)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

setLong

public void setLong(java.sql.PreparedStatement ps,
                    int idx,
                    long o)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

setOlong

public void setOlong(java.sql.PreparedStatement ps,
                     int idx,
                     java.lang.Long o)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setFloat

public void setFloat(java.sql.PreparedStatement ps,
                     int idx,
                     float o)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setOfloat

public void setOfloat(java.sql.PreparedStatement ps,
                      int idx,
                      java.lang.Float o)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

setDouble

public void setDouble(java.sql.PreparedStatement ps,
                      int idx,
                      double o)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

setOdouble

public void setOdouble(java.sql.PreparedStatement ps,
                       int idx,
                       java.lang.Double o)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

setString

public void setString(java.sql.PreparedStatement ps,
                      int idx,
                      java.lang.String o)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

setDate

public void setDate(java.sql.PreparedStatement ps,
                    int idx,
                    java.util.Date o,
                    java.lang.String columnType)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

setCharArray

public void setCharArray(java.sql.PreparedStatement ps,
                         int idx,
                         char[] o)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

setByteArray

public void setByteArray(java.sql.PreparedStatement ps,
                         int idx,
                         byte[] o)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

setBigDecimal

public void setBigDecimal(java.sql.PreparedStatement ps,
                          int idx,
                          java.math.BigDecimal o)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

setSerialized

public void setSerialized(java.sql.PreparedStatement ps,
                          int idx,
                          java.io.Serializable o)
                   throws java.sql.SQLException,
                          java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

getSubstringName

public java.lang.String getSubstringName()

getConcatExpression

public java.lang.String getConcatExpression(java.lang.String op1,
                                            java.lang.String op2)

getFirstLocateExpression

public java.lang.String getFirstLocateExpression(java.lang.String substring,
                                                 java.lang.String instring)
                                          throws PException
Returns the expression for searching the position of the first occurrence of a substring in a string.

Two main syntaxes are found: position(substr in str) and instr(str, substr).

Parameters:
substring - The substring searched
instring - The string in which to search the substring
Returns:
The corresponding relational expression.
Throws:
PException

getIndexedLocateExpression

public java.lang.String getIndexedLocateExpression(java.lang.String inputString,
                                                   java.lang.String substring,
                                                   java.lang.String fromIndex)
                                            throws PException
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()

Parameters:
inputString - The string in which to search the substring
substring - The substring searched
fromIndex - The index from which to start searching
Returns:
The corresponding relational expression.
Throws:
PException

getQuery

public java.lang.String getQuery(java.lang.String selectClause,
                                 java.util.List jts,
                                 java.lang.String whereclause)

writeTableAlias

public void writeTableAlias(java.lang.String alias,
                            java.lang.StringBuffer sb)
Used to write table aliases, for which the syntax may vary (use of 'as', except for Oracle)

Parameters:
alias - The table alias
sb - The StringBuffer into which to write the alias.

handleOrderBy

public java.lang.String handleOrderBy(java.lang.String query)

getNextValInSequence

public java.lang.String getNextValInSequence(java.lang.String seqName)

getCreateSequence

public java.lang.String getCreateSequence(java.lang.String seqName)
                                   throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

getCreateSequence

public java.lang.String getCreateSequence(java.lang.String seqName,
                                          java.lang.Integer startid,
                                          java.lang.Integer increment,
                                          java.lang.Integer cache)
                                   throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

existTable

public boolean existTable(java.sql.Connection connection,
                          java.lang.String tableName)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

existSequence

public boolean existSequence(java.sql.Connection connection,
                             java.lang.String seqName)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getSubqueryAlias

public java.lang.String getSubqueryAlias()
In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.

Returns:
the String to be appended to the subquery