goldengate.common.database.model
Class DbModelPostgresql

java.lang.Object
  extended by goldengate.common.database.model.DbModelAbstract
      extended by goldengate.common.database.model.DbModelPostgresql
All Implemented Interfaces:
DbModel

public abstract class DbModelPostgresql
extends DbModelAbstract

PostGreSQL Database Model implementation

Author:
Frederic Bregier

Nested Class Summary
protected static class DbModelPostgresql.DBType
           
 
Field Summary
static DbType type
           
 
Constructor Summary
DbModelPostgresql()
          Create the object and initialize if necessary the driver
 
Method Summary
 void createTables(DbSession session)
          Create all necessary tables into the database
 DbType getDbType()
           
 String limitRequest(String allfields, String request, int nb)
          Add a limit on the request to get the "limit" first rows.
 long nextSequence(DbSession dbSession)
           
 void resetSequence(DbSession session, long newvalue)
          Reset the sequence (example)
 void validConnection(DbSession dbSession)
          Validate connection
protected  String validConnectionString()
           
 
Methods inherited from class goldengate.common.database.model.DbModelAbstract
closeInternalConnection, currentNumberOfPooledConnections, getDbConnection, releaseResources, validConnectionSelect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public static DbType type
Constructor Detail

DbModelPostgresql

public DbModelPostgresql()
                  throws GoldenGateDatabaseNoConnectionException
Create the object and initialize if necessary the driver

Throws:
GoldenGateDatabaseNoConnectionException
Method Detail

getDbType

public DbType getDbType()
Returns:
the current DbType used

validConnection

public void validConnection(DbSession dbSession)
                     throws GoldenGateDatabaseNoConnectionException
Description copied from interface: DbModel
Validate connection

Specified by:
validConnection in interface DbModel
Overrides:
validConnection in class DbModelAbstract
Throws:
GoldenGateDatabaseNoConnectionException

createTables

public void createTables(DbSession session)
                  throws GoldenGateDatabaseNoConnectionException
Description copied from interface: DbModel
Create all necessary tables into the database

Parameters:
session - SQL session
Throws:
GoldenGateDatabaseNoConnectionException

resetSequence

public void resetSequence(DbSession session,
                          long newvalue)
                   throws GoldenGateDatabaseNoConnectionException
Description copied from interface: DbModel
Reset the sequence (example)

Parameters:
session - SQL session
Throws:
GoldenGateDatabaseNoConnectionException

nextSequence

public long nextSequence(DbSession dbSession)
                  throws GoldenGateDatabaseNoConnectionException,
                         GoldenGateDatabaseSqlException,
                         GoldenGateDatabaseNoDataException
Returns:
The next unique specialId
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException
GoldenGateDatabaseNoDataException

validConnectionString

protected String validConnectionString()
Specified by:
validConnectionString in class DbModelAbstract
Returns:
the associated String to validate the connection (as "select 1 frm dual")

limitRequest

public String limitRequest(String allfields,
                           String request,
                           int nb)
Description copied from interface: DbModel
Add a limit on the request to get the "limit" first rows. Note that it must be compatible to add the "limit" condition.
DO NOT CHANGE (add) ANYTHING to the request
On Oracle: select allfield from (request) where rownnum <= limit
On others: request LIMIT limit

Parameters:
allfields - string representing the equivalent to "*" in "select *" but more precisely as "field1, field2" in "select field1, field2"
Returns:
the new request String which will limit the result to the specified number of rows


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.