Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.impl.jdbc.schema.dict
Class PostgresDictionary

    java.lang.Object
      |
      +--com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
            |
            +--com.solarmetric.kodo.impl.jdbc.schema.dict.PostgresDictionary

All Implemented Interfaces:
  DBDictionary

public class PostgresDictionary
extends AbstractDictionary

Implementation of `DBDictionary` for PostgreSQL. This dictionary contains workaround for various issues with the postgres JDBC driver. Most notably, the official Postgres JDBC driver cannot handle strings of length 0, either in normal or prepared statements. Thus, we need to set the String to something (we use "null").

Fields inherited from class com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
`CENTI, DECI, meta, MICRO, MILLI, NANO, NUMBER_FORMAT, SEC`

Constructor Summary
`PostgresDictionary()`

Method Summary
`Object` | `blobFromSQL(ResultSet rs, int column)`
`void` | `booleanToPreparedParameter(PreparedStatement st, int index, Boolean val)`
`void` | `characterToPreparedParameter(PreparedStatement st, int index, Character val)`
`void` | `clobToPreparedParameter(PreparedStatement st, int index, Object val)`
`Date` | `dateFromSQL(ResultSet rs, int column)`
`Object` | `dateToSQL(Date val)`
`SQLBuffer[]` | `getAddColumnSQL(Column column)` PostgreSQL has special needs when altering PK columns.
`protected SQLBuffer` | `getColumnDeclaration(Column column, boolean ignorePK)` This method can be overridden if the database does not support standard column declarations, which are in the form: `<column-name> <sql-type> [NOT NULL]`.
`protected int` | `getDatePrecision()` Return the precision to which dates are stored in this type of data store.
`SQLBuffer[]` | `getDropColumnSQL(Column column)` PostgreSQL can't deal with dropping columns.
`String` | `getPlatform()` Return the title of this database platform, used for display only.
`String` | `getValidIndexName(String name)` Limits index names to `getMaxIndexNameLength()`-1 plus an 'I' that is appended to the end of the given name to avoid SQL keyword conflicts.
`protected void` | `setupSQLTypeMap(SQLTypeMap map)` This is the most commonly overridden method when porting to a new database.
`String` | `stringToSQL(String string)` PostgreSQL seems to use '\' as a quote character as well as '.
`SQLBuffer` | `toSelect(String[] cols, String[] tables, SQLBuffer where, SQLBuffer order, boolean distinct, boolean update)` Appends the given pieces using standard SQL.

Methods inherited from class com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
`addForUpdateClause, bigDecimalFromSQL, bigDecimalToPreparedParameter, bigDecimalToSQL, bigIntegerFromSQL, bigIntegerToPreparedParameter, bigIntegerToSQL, blobToPreparedParameter, blobToSQL, booleanFromSQL, booleanToSQL, byteFromSQL, byteToPreparedParameter, byteToSQL, charFromSQL, charToSQL, clobFromSQL, clobToSQL, colsToString, dateToPreparedParameter, dateToTimestamp, doubleFromSQL, doubleToPreparedParameter, doubleToSQL, floatFromSQL, floatToPreparedParameter, floatToSQL, fromSQL, getClassMappingCandidateClasses, getColumnDeclaration, getColumns, getCreateIndexSQL, getCreateTableSQL, getDBMetaData, getDropIndexSQL, getDropTableSQL, getFieldMappingCandidateClasses, getMaxColumnNameLength, getMaxIndexNameLength, getMaxTableNameLength, getNameTruncationVersion, getQuoteNumbers, getSchemaName, getSimulateLocking, getSQLTypeMap, getStoreCharsAsStrings, getStoreLargeNumbersAsStrings, getTables, getValidateConnections, getValidateConnectionSQL, getValidColumnName, getValidTableName, initTypeMap, intFromSQL, intToPreparedParameter, intToSQL, isClosed, localeFromSQL, localeToPreparedParameter, localeToSQL, longFromSQL, longToPreparedParameter, longToSQL, objectFromSQL, objectToPreparedParameter, objectToSQL, prepareLargeNumberAsString, setColumnNameGenerator, setCursorName, setDBMetaData, setIndexNameGenerator, setMaxColumnNameLength, setMaxIndexNameLength, setMaxTableNameLength, setNameTruncationVersion, setNullParameter, setQuoteNumbers, setSchemaName, setSimulateLocking, setStoreCharsAsStrings, setStoreLargeNumbersAsStrings, setTableNameGenerator, setTransactionIsolation, setValidateConnections, setValidateConnectionSQL, shortFromSQL, shortToPreparedParameter, shortToSQL, stringFromSQL, stringToPreparedParameter, supportsLocking, supportsUpdateCountsForBatch, tablesToString, toPreparedParameter, toSelect, toSelect, toSQL`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PostgresDictionary

    public PostgresDictionary()

Method Detail

### getPlatform

    public String getPlatform()

  Description copied from class: `AbstractDictionary`
  Return the title of this database platform, used for display only.
  Overrides:
    `getPlatform` in class `AbstractDictionary`

### stringToSQL

    public String stringToSQL(String string)

  PostgreSQL seems to use '\' as a quote character as well as '.
  Overrides:
    `stringToSQL` in class `AbstractDictionary`

### clobToPreparedParameter

    public void clobToPreparedParameter(PreparedStatement st,
                                        int index,
                                        Object val)
                                 throws SQLException

  Overrides:
    `clobToPreparedParameter` in class `AbstractDictionary`

### characterToPreparedParameter

    public void characterToPreparedParameter(PreparedStatement st,
                                             int index,
                                             Character val)
                                      throws SQLException

  Overrides:
    `characterToPreparedParameter` in class `AbstractDictionary`

### dateToSQL

    public Object dateToSQL(Date val)

  Overrides:
    `dateToSQL` in class `AbstractDictionary`

### setupSQLTypeMap

    protected void setupSQLTypeMap(SQLTypeMap map)

  Description copied from class: `AbstractDictionary`
  This is the most commonly overridden method when porting to a new database. Most databases have different mappings between java and SQL types; this method can be used to setup the mappings for the database being ported.
  Overrides:
    `setupSQLTypeMap` in class `AbstractDictionary`

### getDropColumnSQL

    public SQLBuffer[] getDropColumnSQL(Column column)

  PostgreSQL can't deal with dropping columns.
  Overrides:
    `getDropColumnSQL` in class `AbstractDictionary`

### getAddColumnSQL

    public SQLBuffer[] getAddColumnSQL(Column column)

  PostgreSQL has special needs when altering PK columns.
  Overrides:
    `getAddColumnSQL` in class `AbstractDictionary`

### getColumnDeclaration

    protected SQLBuffer getColumnDeclaration(Column column,
                                             boolean ignorePK)

  This method can be overridden if the database does not support standard column declarations, which are in the form: `<column-name> <sql-type> [NOT NULL]`. Where NOT NULL is appended if it is a primary key column.

### toSelect

    public SQLBuffer toSelect(String[] cols,
                              String[] tables,
                              SQLBuffer where,
                              SQLBuffer order,
                              boolean distinct,
                              boolean update)

  Description copied from class: `AbstractDictionary`
  Appends the given pieces using standard SQL.
  Overrides:
    `toSelect` in class `AbstractDictionary`
  Following copied from interface: `com.solarmetric.kodo.impl.jdbc.schema.DBDictionary`
  Parameters:
    `cols` - list of values the columns to select
    `tables` - list of the tables to select from
    `where` - the WHERE conditions; may be null if none
    `order` - the ORDER BY conditions; may be null if none
    `distinct` - if true, this should be a SELECT DISTINCT-equivalent query
    `update` - if true this should be a SELECT FOR UPDATE-equivalent query

### blobFromSQL

    public Object blobFromSQL(ResultSet rs,
                              int column)
                       throws SQLException

  Overrides:
    `blobFromSQL` in class `AbstractDictionary`

### dateFromSQL

    public Date dateFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

  Overrides:
    `dateFromSQL` in class `AbstractDictionary`

### getDatePrecision

    protected int getDatePrecision()

  Description copied from class: `AbstractDictionary`
  Return the precision to which dates are stored in this type of data store. Returns MILLI by default, as java.util.Date is only precise to the nearest millisecond. This value is used when generating timestamps to store in the data store. It is important that we never generate SQL data with greater precision than what will be returned to us, as otherwise we can get into awkward situations in which we cannot use retrieved values in where clauses since the data is not sufficiently precise. SQLServer behaves strangely here. It returns values whose millis are not accurate, but allows SELECT, DELETE statements using these non-accurate milli values. It must perform some internal rounding. Oracle, MySQL return values precise to the second on select, but will select/delete all values in a particular second, not just those values with exactly 0 nanos.
  Overrides:
    `getDatePrecision` in class `AbstractDictionary`

### getValidIndexName

    public String getValidIndexName(String name)

  Limits index names to `getMaxIndexNameLength()`-1 plus an 'I' that is appended to the end of the given name to avoid SQL keyword conflicts.
  Overrides:
    `getValidIndexName` in class `AbstractDictionary`

### booleanToPreparedParameter

    public void booleanToPreparedParameter(PreparedStatement st,
                                           int index,
                                           Boolean val)
                                    throws SQLException

  Overrides:
    `booleanToPreparedParameter` in class `AbstractDictionary`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.