org.melati.poem.dbms
Class Postgresql

Package class diagram package Postgresql
java.lang.Object
  extended by org.melati.poem.dbms.AnsiStandard
      extended by org.melati.poem.dbms.Postgresql
All Implemented Interfaces:
Dbms

public class Postgresql
extends AnsiStandard

A Driver for Postgresql. See http://www.postgresql.org/


Field Summary
 
Fields inherited from class org.melati.poem.dbms.AnsiStandard
schema
 
Constructor Summary
Postgresql()
          Constructor.
 
Method Summary
 boolean canDropColumns(Connection con)
          Whether this DBMS can drop columns.
 SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet md)
          The simplest POEM type corresponding to a JDBC description from the database.
 SQLPoemException exceptionForUpdate(Table table, String sql, boolean insert, SQLException e)
          An exception appropriate for expressing what really went wrong during a write to the db.
 String getBinarySqlDefinition(int size)
          Accomodate different treatment of different sized binary data.
 String getStringSqlDefinition(int size)
          Accomodate String/Text distinction.
 String preparedStatementPlaceholder(PoemType type)
          Accomodate casting in placeholders.
 
Methods inherited from class org.melati.poem.dbms.AnsiStandard
alterColumnNotNullableSQL, booleanTrueExpression, canBeIndexed, canDropColumns, canRepresent, canStoreBlobs, caseInsensitiveRegExpSQL, createTableOptionsSql, createTableSql, createTableTypeQualifierSql, exceptionForUpdate, getConnection, getDriverClassName, getDriverLoaded, getFixedPtSqlDefinition, getForeignKeyDefinition, getIndexLength, getJdbcMetadataName, getLongSqlDefinition, getPrimaryKeyDefinition, getQuotedName, getQuotedValue, getSchema, getSqlDefaultValue, getSqlDefinition, givesCapabilitySQL, loadDriver, melatiName, selectLimit, setDriverClassName, setDriverLoaded, shutdown, sqlBooleanValueOfRaw, tableInitialisationSql, toString, unloadDriver, unreservedName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Postgresql

public Postgresql()
Constructor.

Method Detail

canDropColumns

public boolean canDropColumns(Connection con)
                       throws SQLException
Whether this DBMS can drop columns. Postgresql has been able to since 7.4

Parameters:
con - the current connection
Returns:
true if we can
Throws:
SQLException
See Also:
org.melati.poem.dbms.AnsiStandard#canDropColumns(java.sql.Connection)

preparedStatementPlaceholder

public String preparedStatementPlaceholder(PoemType type)
Accomodate casting in placeholders.

Specified by:
preparedStatementPlaceholder in interface Dbms
Overrides:
preparedStatementPlaceholder in class AnsiStandard
Parameters:
type - the type to cast
Returns:
the place holder string
See Also:
AnsiStandard.preparedStatementPlaceholder(org.melati.poem.PoemType)

getStringSqlDefinition

public String getStringSqlDefinition(int size)
                              throws SQLException
Accomodate String/Text distinction.

Specified by:
getStringSqlDefinition in interface Dbms
Overrides:
getStringSqlDefinition in class AnsiStandard
Parameters:
size - the string length (-1 means no limit)
Returns:
the SQL definition for a string of this size
Throws:
SQLException
See Also:
AnsiStandard.getStringSqlDefinition(int)

getBinarySqlDefinition

public String getBinarySqlDefinition(int size)
                              throws SQLException
Accomodate different treatment of different sized binary data.

Specified by:
getBinarySqlDefinition in interface Dbms
Overrides:
getBinarySqlDefinition in class AnsiStandard
Parameters:
size - how big the field is
Returns:
the keyword to use
Throws:
SQLException
See Also:
AnsiStandard.getBinarySqlDefinition(int)

defaultPoemTypeOfColumnMetaData

public SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet md)
                                            throws SQLException
The simplest POEM type corresponding to a JDBC description from the database.

Specified by:
defaultPoemTypeOfColumnMetaData in interface Dbms
Overrides:
defaultPoemTypeOfColumnMetaData in class AnsiStandard
Parameters:
md - the JDBC metadata
Returns:
the PoemType to use
Throws:
SQLException - potentially
See Also:
defaultPoemTypeOfColumnMetaData(java.sql.ResultSet)

exceptionForUpdate

public SQLPoemException exceptionForUpdate(Table table,
                                           String sql,
                                           boolean insert,
                                           SQLException e)
An exception appropriate for expressing what really went wrong during a write to the db. This gives the opportunity to try to interpret the getMessage text returned by the underlying driver, so that a more friendly error page can be put together for the user. Canonically, this is used to separate out "duplicate key" errors from more serious problems.

Specified by:
exceptionForUpdate in interface Dbms
Overrides:
exceptionForUpdate in class AnsiStandard
Parameters:
table - The table on which the update was affected
sql - The operation attempted, or possibly null
insert - Whether the operation was an INSERT as opposed to an UPDATE
e - The raw SQL exception: the routine is meant to try to interpret e.getMessage if it can
Returns:
an appropriate exception
See Also:
AnsiStandard.exceptionForUpdate(org.melati.poem.Table, java.lang.String, boolean, java.sql.SQLException)


Copyright © 2000-2010 PanEris. All Rights Reserved.