goldengate.common.database
Class DbRequest

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

public class DbRequest
extends Object

Class to handle request

Author:
Frederic Bregier

Constructor Summary
DbRequest(DbSession ls)
          Create a new request from the DbSession
 
Method Summary
 void close()
          Finished a Request (ready for a new one)
static String getIsNull(String value)
          Test if value is null and create the string for insert/update
 long getLastId()
          Get the last ID autoincrement from the last request
 boolean getNext()
          Move the cursor to the next result
 ResultSet getResultSet()
           
 int query(String query)
          Execute a UPDATE/INSERT/DELETE statement and returns the number of row.
 void select(String select)
          Execute a SELECT statement and set of Result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbRequest

public DbRequest(DbSession ls)
          throws GoldenGateDatabaseNoConnectionException
Create a new request from the DbSession

Parameters:
ls -
Throws:
GoldenGateDatabaseNoConnectionException
Method Detail

select

public void select(String select)
            throws GoldenGateDatabaseNoConnectionException,
                   GoldenGateDatabaseSqlException
Execute a SELECT statement and set of Result. The statement must not be an update/insert/delete. The previous statement and resultSet are closed.

Parameters:
select -
Throws:
GoldenGateDatabaseSqlException
GoldenGateDatabaseNoConnectionException

query

public int query(String query)
          throws GoldenGateDatabaseNoConnectionException,
                 GoldenGateDatabaseSqlException
Execute a UPDATE/INSERT/DELETE statement and returns the number of row. The previous statement and resultSet are closed.

Parameters:
query -
Returns:
the number of row in the query
Throws:
GoldenGateDatabaseSqlException
GoldenGateDatabaseNoConnectionException

close

public void close()
Finished a Request (ready for a new one)


getLastId

public long getLastId()
               throws GoldenGateDatabaseNoDataException
Get the last ID autoincrement from the last request

Returns:
the long Id or DbConstant.ILLEGALVALUE (Long.MIN_VALUE) if an error occurs.
Throws:
GoldenGateDatabaseNoDataException

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

getIsNull

public static String getIsNull(String value)
Test if value is null and create the string for insert/update

Parameters:
value -
Returns:
the string as result


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