goldengate.common.database
Class DbPreparedStatement

java.lang.Object
  extended by goldengate.common.database.DbPreparedStatement

public class DbPreparedStatement
extends Object

Class to handle PrepareStatement

Author:
Frederic Bregier

Field Summary
 boolean isReady
          Is this PreparedStatement ready
 
Constructor Summary
DbPreparedStatement(DbSession ls)
          Create a DbPreparedStatement from DbSession object
DbPreparedStatement(DbSession ls, String request)
          Create a DbPreparedStatement from DbSession object and a request
DbPreparedStatement(DbSession ls, String request, int nbFetch)
          Create a DbPreparedStatement from DbSession object and a request
 
Method Summary
 void close()
          Close the resultSet if any
 void createPrepareStatement(String requestarg)
          Create a preparedStatement from request
 void executeQuery()
          Execute a Select preparedStatement
 int executeUpdate()
          Execute the Update/Insert/Delete preparedStatement
 DbSession getDbSession()
           
 boolean getNext()
          Move the cursor to the next result
 PreparedStatement getPreparedStatement()
           
 ResultSet getResultSet()
           
 void realClose()
          Really close the preparedStatement and the resultSet if any
 void recreatePreparedStatement()
          In case of closing database connection, it is possible to reopen a long term preparedStatement as it was at creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isReady

public boolean isReady
Is this PreparedStatement ready

Constructor Detail

DbPreparedStatement

public DbPreparedStatement(DbSession ls)
                    throws GoldenGateDatabaseNoConnectionException
Create a DbPreparedStatement from DbSession object

Parameters:
ls -
Throws:
GoldenGateDatabaseNoConnectionException

DbPreparedStatement

public DbPreparedStatement(DbSession ls,
                           String request)
                    throws GoldenGateDatabaseNoConnectionException,
                           GoldenGateDatabaseSqlException
Create a DbPreparedStatement from DbSession object and a request

Parameters:
ls -
request -
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException

DbPreparedStatement

public DbPreparedStatement(DbSession ls,
                           String request,
                           int nbFetch)
                    throws GoldenGateDatabaseNoConnectionException,
                           GoldenGateDatabaseSqlException
Create a DbPreparedStatement from DbSession object and a request

Parameters:
ls -
request -
nbFetch - the number of pre fetch rows
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException
Method Detail

createPrepareStatement

public void createPrepareStatement(String requestarg)
                            throws GoldenGateDatabaseNoConnectionException,
                                   GoldenGateDatabaseSqlException
Create a preparedStatement from request

Parameters:
requestarg -
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException

recreatePreparedStatement

public void recreatePreparedStatement()
                               throws GoldenGateDatabaseNoConnectionException,
                                      GoldenGateDatabaseSqlException
In case of closing database connection, it is possible to reopen a long term preparedStatement as it was at creation.

Throws:
GoldenGateDatabaseSqlException
GoldenGateDatabaseNoConnectionException

executeQuery

public void executeQuery()
                  throws GoldenGateDatabaseNoConnectionException,
                         GoldenGateDatabaseSqlException
Execute a Select preparedStatement

Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException

executeUpdate

public int executeUpdate()
                  throws GoldenGateDatabaseNoConnectionException,
                         GoldenGateDatabaseSqlException
Execute the Update/Insert/Delete preparedStatement

Returns:
the number of row
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException

close

public void close()
Close the resultSet if any


realClose

public void realClose()
Really close the preparedStatement and the resultSet if any


getNext

public boolean getNext()
                throws GoldenGateDatabaseNoConnectionException,
                       GoldenGateDatabaseSqlException
Move the cursor to the next result

Returns:
True if there is a next result, else False
Throws:
GoldenGateDatabaseNoConnectionException
GoldenGateDatabaseSqlException

getResultSet

public ResultSet getResultSet()
                       throws GoldenGateDatabaseNoConnectionException
Returns:
The resultSet (can be used in conjunction of getNext())
Throws:
GoldenGateDatabaseNoConnectionException

getPreparedStatement

public PreparedStatement getPreparedStatement()
                                       throws GoldenGateDatabaseNoConnectionException
Returns:
The preparedStatement (should be used in conjunction of createPreparedStatement)
Throws:
GoldenGateDatabaseNoConnectionException

getDbSession

public DbSession getDbSession()
Returns:
the dbSession


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