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

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

public class PostgresAdapter
extends BasicRdbAdapter

Author:
S. Chassande-Barrioz

Constructor Summary
PostgresAdapter()
           
 
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 calculates the size of a result set.
 java.lang.String getConcatExpression(java.lang.String op1, java.lang.String op2)
           
 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)
          This method returns the sql getter 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.
 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 getValueAsSQLString(boolean value)
          This method returns a String value that represents a boolean value.
 boolean supportBatchPreparedStatement()
          Indicates if the driver supports the batch of PreparedStatement
 
Methods inherited from class org.objectweb.jorm.mapper.rdb.adapter.BasicRdbAdapter
getBigDecimal, getBigInteger, getBoolean, getByte, getByteArray, getCACHEkeyWord, getChar, getCharArray, getCharArray, getCreateSequence, getCreateSequence, getDate, getDate, getDouble, getFirstLocateExpression, getFloat, getFromClause, getFromClause, getINCREMENTkeyWord, getInt, getLong, getNextValInSequence, getOboolean, getObyte, getOchar, getOdouble, getOfloat, getOint, getOlong, getOshort, getQuery, getSerialized, getShort, getSqlGetterName, getSqlSetterName, getSqlSetterName, getSqlTypeCode, getSqlTypeCode, getSTARTkeyWord, getString, getSubstringName, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getValueAsSQLString, getWhereClause, handleOrderBy, setBigDecimal, setBigInteger, setBoolean, setByte, setByteArray, setChar, setCharArray, setDate, 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
 

Constructor Detail

PostgresAdapter

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

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

getValueAsSQLString

public java.lang.String getValueAsSQLString(boolean value)
Description copied from interface: RdbAdapter
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 RdbAdapter
Overrides:
getValueAsSQLString in class BasicRdbAdapter

getConcatExpression

public java.lang.String getConcatExpression(java.lang.String op1,
                                            java.lang.String op2)
Specified by:
getConcatExpression in interface RdbAdapter
Overrides:
getConcatExpression in class BasicRdbAdapter

getIndexedLocateExpression

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

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

getSqlGetterName

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

existSequence

public boolean existSequence(java.sql.Connection connection,
                             java.lang.String seqName)
                      throws java.sql.SQLException
Specified by:
existSequence in interface RdbAdapter
Overrides:
existSequence in class BasicRdbAdapter
Throws:
java.sql.SQLException

existTable

public boolean existTable(java.sql.Connection connection,
                          java.lang.String tableName)
                   throws java.sql.SQLException
Specified by:
existTable in interface RdbAdapter
Overrides:
existTable in class BasicRdbAdapter
Throws:
java.sql.SQLException

getSubqueryAlias

public java.lang.String getSubqueryAlias()
Description copied from interface: RdbAdapter
In the case the subquery needs to be aliased (Postgres), returns a string to be appended to the subquery.

Specified by:
getSubqueryAlias in interface RdbAdapter
Overrides:
getSubqueryAlias in class BasicRdbAdapter