openlsd.database.session.LSDDbRequest Class Reference

Collaboration diagram for openlsd.database.session.LSDDbRequest:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class to handle request
Author:
Frederic Bregier LGPL

Public Member Functions

 LSDDbRequest (LSDDbSession ls)
ResultSet select (String select)
ResultSet select (String select, int nbFetch)
int query (String query)
void close ()
long getLastId ()

Static Public Member Functions

static long getLastId (ResultSet resultSet)
static boolean getNext (ResultSet resultSet)
static String getIsNull (String value)

Private Member Functions

Statement createStatement () throws SQLException

Private Attributes

Statement stmt = null
ResultSet rs = null
LSDDbSession ls = null

Constructor & Destructor Documentation

openlsd.database.session.LSDDbRequest.LSDDbRequest ( LSDDbSession  ls  ) 

Create a new request from the LSDDbSession

Parameters:
ls 


Member Function Documentation

Statement openlsd.database.session.LSDDbRequest.createStatement (  )  throws SQLException [private]

Create a statement with some particular options

Exceptions:
SQLException 
Returns:
the new Statement

ResultSet openlsd.database.session.LSDDbRequest.select ( String  select  ) 

Execute a SELECT statement and returns the set of Result. The statement must not be an update/insert/delete, since it will return null, as if an error occurs. The previous statement and resultSet are closed.

Parameters:
select 
Returns:
the set of Result or null if an error occurs

ResultSet openlsd.database.session.LSDDbRequest.select ( String  select,
int  nbFetch 
)

Execute a SELECT statement and returns the set of Result. The statement must not be an update/insert/delete, since it will return null, as if an error occurs. The previous statement and resultSet are closed.

Parameters:
select 
nbFetch the number of pre fetch rows
Returns:
the set of Result or null if an error occurs

int openlsd.database.session.LSDDbRequest.query ( String  query  ) 

Execute a UPDATE/INSERT/DELETE statement and returns the number of row or -1 if an error occurs The previous statement and resultSet are closed.

Parameters:
query 
Returns:
the number of row in the query

void openlsd.database.session.LSDDbRequest.close (  ) 

Finished a Request (ready for a new one)

long openlsd.database.session.LSDDbRequest.getLastId (  ) 

Get the last ID autoincrement from the last request

Returns:
the long Id or LSDConstant.invalide_idx (Long.MIN_VALUE) if an error occurs.

static long openlsd.database.session.LSDDbRequest.getLastId ( ResultSet  resultSet  )  [static]

Get the last ID autoincrement from the result

Parameters:
resultSet 
Returns:
the long Id or LSDConstant.invalide_idx (Long.MIN_VALUE) if an error occurs.

static boolean openlsd.database.session.LSDDbRequest.getNext ( ResultSet  resultSet  )  [static]

Move the cursor to the next result

Parameters:
resultSet 
Returns:
True if there is a next result, else False

static String openlsd.database.session.LSDDbRequest.getIsNull ( String  value  )  [static]

Test if value is null and create the string for insert/update

Parameters:
value 
Returns:
the string as result


Member Data Documentation

Statement openlsd.database.session.LSDDbRequest.stmt = null [private]

Internal Statement

ResultSet openlsd.database.session.LSDDbRequest.rs = null [private]

Internal Result Set

Internal DB Session


The documentation for this class was generated from the following file: