goldengate.common.database.model
Interface DbModel

All Known Implementing Classes:
DbModelAbstract, DbModelH2, DbModelMysql, DbModelOracle, DbModelPostgresql

public interface DbModel

Interface for Database Model This class is an interface for special functions that needs special implementations according to the database model used.

Author:
Frederic Bregier

Method Summary
 void createTables(DbSession session)
          Create all necessary tables into the database
 int currentNumberOfPooledConnections()
           
 Connection getDbConnection(String server, String user, String passwd)
           
 DbType getDbType()
           
 String limitRequest(String allfields, String request, int limit)
          Add a limit on the request to get the "limit" first rows.
 long nextSequence(DbSession dbSession)
           
 void releaseResources()
          Release any internal resources if needed
 void resetSequence(DbSession session, long newvalue)
          Reset the sequence (example)
 void validConnection(DbSession dbSession)
          Validate connection
 

Method Detail

getDbConnection

Connection getDbConnection(String server,
                           String user,
                           String passwd)
                           throws SQLException
Parameters:
server -
user -
passwd -
Returns:
a connection according to the underlying Database Model
Throws:
SQLException

releaseResources

void releaseResources()
Release any internal resources if needed


currentNumberOfPooledConnections

int currentNumberOfPooledConnections()
Returns:
the number of Pooled Connections if any

getDbType

DbType getDbType()
Returns:
the current DbType used

createTables

void createTables(DbSession session)
                  throws GoldenGateDatabaseNoConnectionException
Create all necessary tables into the database

Parameters:
session - SQL session
Throws:
GoldenGateDatabaseNoConnectionException

resetSequence

void resetSequence(DbSession session,
                   long newvalue)
                   throws GoldenGateDatabaseNoConnectionException
Reset the sequence (example)

Parameters:
session - SQL session
Throws:
GoldenGateDatabaseNoConnectionException

nextSequence

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

validConnection

void validConnection(DbSession dbSession)
                     throws GoldenGateDatabaseNoConnectionException
Validate connection

Parameters:
dbSession -
Throws:
GoldenGateDatabaseNoConnectionException

limitRequest

String limitRequest(String allfields,
                    String request,
                    int limit)
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"
request -
limit -
Returns:
the new request String which will limit the result to the specified number of rows


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