edu.ucsb.nceas.dbadapter
Class PostgresqlAdapter
java.lang.Object
|
+--edu.ucsb.nceas.dbadapter.AbstractDatabase
|
+--edu.ucsb.nceas.dbadapter.PostgresqlAdapter
- public class PostgresqlAdapter
- extends AbstractDatabase
The PostgreSQL db adapter implementation.
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 |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PostgresqlAdapter
public PostgresqlAdapter()
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.
- Overrides:
getUniqueID
in class AbstractDatabase
- Parameters:
conn
- db connection in which the unique id was generatedtableName
- 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
- Overrides:
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
- Overrides:
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 (')
- Overrides:
getStringDelimiter
in class AbstractDatabase
- Returns:
- return the string delimiter: single quote (')
Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.