Public Member Functions

dbSession Class Reference

#include <session.h>

List of all members.

Public Member Functions

 dbSession (char const *address, int max_connect_attempts=10, int reconnect_timeout_sec=1, char_t const *user_name=_T(""), char_t const *password=_T(""))
 ~dbSession ()
template<class T >
void select (dbQuery const &query, size_t limit=0)
void reset ()
template<class T >
dbReference< T > next (T &record)
template<class T >
dbReference< T > insert (T const &record, bool batch=false)
template<class T >
bool update (T const &record, dbReference< T > ref)
template<class T >
void remove (dbReference< T > ref)
template<class T >
size_t remove (dbQuery const &condition, size_t limit=0)
void commit ()
void lock ()
void unlock ()
void rollback ()

Detailed Description

Class representing remote connection to GiggaBASE server.


Constructor & Destructor Documentation

dbSession::dbSession ( char const *  address,
int  max_connect_attempts = 10,
int  reconnect_timeout_sec = 1,
char_t const *  user_name = _T(""),
char_t const *  password = _T("") 
)

Create new session

Parameters:
address server host address and poty, for example "192.168.1.100:1234"
max_connect_attempts - number of attempts to establish connection
reconnect_timeout_sec - timeput in seconds between connection attempts
user_name - user name for login
password - password for login
dbSession::~dbSession (  ) 

Cleanup session data


Member Function Documentation

void dbSession::commit (  ) 

Commit current transaction (new transaction is started implcitly)

template<class T >
dbReference<T> dbSession::insert ( T const &  record,
bool  batch = false 
) [inline]

Insert new record in the database

Parameters:
record inserted record data
batch if true then record will be inserted in the batch mode: it will be included in indices at the trasnaction commit time
Returns:
reference assigned to the inserted object
void dbSession::lock (  ) 

Exclusively lock the database

template<class T >
dbReference<T> dbSession::next ( T &  record  )  [inline]

Move to the next selewcted record. Thisd method should be used after select to iterate through query results.

Parameters:
record destination where current record will be extracred
Returns:
reference to the current object or null reference when there are no more records (end of selcetion is reached)
template<class T >
void dbSession::remove ( dbReference< T >  ref  )  [inline]

Remove referenced record

Parameters:
ref reference to the record to be removed
template<class T >
size_t dbSession::remove ( dbQuery const &  condition,
size_t  limit = 0 
) [inline]

Remove objects matching specified criteria

Parameters:
condition criteria for selecting records for deletion
limit maximal number of removed records (0 - unlimited)
Returns:
number of selected objects
void dbSession::reset (  ) 

Reset cursor: release all resource hold be opened cursor

void dbSession::rollback (  ) 

Rollback current transaction

template<class T >
void dbSession::select ( dbQuery const &  query,
size_t  limit = 0 
) [inline]

Execute query. You shoul duse next method to iterate through query results.

Parameters:
query constructed query
limit maximal number of selected records (0 means no limit)
void dbSession::unlock (  ) 

Release transaction locks

template<class T >
bool dbSession::update ( T const &  record,
dbReference< T >  ref 
) [inline]

Update referenced record

Parameters:
record updated record data
ref reference to the updated record

References dbAnyReference::getOid().


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