edu.ucsb.nceas.dbadapter
Class PostgresqlAdapter

java.lang.Object
  extended by edu.ucsb.nceas.dbadapter.AbstractDatabase
      extended by edu.ucsb.nceas.dbadapter.PostgresqlAdapter

public class PostgresqlAdapter
extends AbstractDatabase

The PostgreSQL db adapter implementation.


Constructor Summary
PostgresqlAdapter()
           
 
Method Summary
 java.lang.String getDateTimeFunction()
          The PostgreSQL function name that gets the current date and time from the database server
 java.lang.String getIsNULLFunction()
          The PostgreSQL function name that is used to return non-NULL value
 java.lang.String getLeftJoinQuery(java.lang.String selectFields, java.lang.String tableA, java.lang.String tableB, java.lang.String joinCriteria, java.lang.String nonJoinCriteria)
          PostgreSQL's syntax for doing a left join Add 'a.' in front of the fields for first table and 'b.' in front of the fields for the second table
 java.lang.String getReplicationDocumentListSQL()
          Return a hard code string to get xml_document list in timed replcation
 java.lang.String getStringDelimiter()
          PostgreSQL's string delimiter character: single quote (')
 long getUniqueID(java.sql.Connection conn, java.lang.String tableName)
          The PostgreSQL unique ID /sequence generator The name of the sequence used to generate the unique id is made from the name of the table that uses the id by appending "_id_seq" to it.
 
Methods inherited from class edu.ucsb.nceas.dbadapter.AbstractDatabase
createObject, main, toDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgresqlAdapter

public PostgresqlAdapter()
Method Detail

getUniqueID

public long getUniqueID(java.sql.Connection conn,
                        java.lang.String tableName)
                 throws java.sql.SQLException
The PostgreSQL unique ID /sequence generator The name of the sequence used to generate the unique id is made from the name of the table that uses the id by appending "_id_seq" to it. When record is inserted in the table and insert trigger gets a nextval from that sequence, select currval of that sequence can return the generated key in the same db connection.

Specified by:
getUniqueID in class AbstractDatabase
Parameters:
conn - db connection in which the unique id was generated
tableName - the name of table which unique id was generate
Returns:
return the generated unique id as a long type
Throws:
java.sql.SQLException - any SQLException that can be thrown during the db operation

getDateTimeFunction

public java.lang.String getDateTimeFunction()
The PostgreSQL function name that gets the current date and time from the database server

Specified by:
getDateTimeFunction in class AbstractDatabase
Returns:
return the current date and time function name: "now()"

getIsNULLFunction

public java.lang.String getIsNULLFunction()
The PostgreSQL function name that is used to return non-NULL value

Specified by:
getIsNULLFunction in class AbstractDatabase
Returns:
return the non-NULL function name: "coalesce"

getStringDelimiter

public java.lang.String getStringDelimiter()
PostgreSQL's string delimiter character: single quote (')

Specified by:
getStringDelimiter in class AbstractDatabase
Returns:
return the string delimiter: single quote (')

getLeftJoinQuery

public java.lang.String getLeftJoinQuery(java.lang.String selectFields,
                                         java.lang.String tableA,
                                         java.lang.String tableB,
                                         java.lang.String joinCriteria,
                                         java.lang.String nonJoinCriteria)
PostgreSQL's syntax for doing a left join Add 'a.' in front of the fields for first table and 'b.' in front of the fields for the second table

Specified by:
getLeftJoinQuery in class AbstractDatabase
Parameters:
selectFields - fields that you want to be selected
tableA - first table in the join
tableB - second table in the join
joinCriteria - the criteria based on which the join will be made
nonJoinCriteria - all other criterias
Returns:
return the string for teh select query

getReplicationDocumentListSQL

public java.lang.String getReplicationDocumentListSQL()
Return a hard code string to get xml_document list in timed replcation

Specified by:
getReplicationDocumentListSQL in class AbstractDatabase
Returns:


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.