Connection Class Reference

Represents a database connection. More...


Public Member Functions

DbRetVal open (const char *username, const char *password)
 opens connection to the database
DbRetVal close ()
 closes connection to the database and releases all the resources
DatabaseManagergetDatabaseManager ()
 gets the database manager object.
UserManagergetUserManager ()
 gets the user manager object.
DbRetVal startTransaction (IsolationLevel level=READ_COMMITTED)
 Starts a transaction.
DbRetVal commit ()
 Commits active transaction.
DbRetVal rollback ()
 Aborts the active transaction.


Detailed Description

Represents a database connection.

All database operations shall be done within the context of the connection.
Application should first create object of this class for accessing the database.
Each connection has only one active transaction at any given point of time, all
operations which happen using this connection object will be done as part of that
transaction.

Functionality:
1.Connection Management (connect and disconnect)
2.Transaction Management (start, commit, abort)
3.Provides getter methods for database manager and user manager
4.Isolation Level support. REPEATABLE READ,
READ COMMITTED and READ UNCOMMITTED isolation levels

Note:
SERIALIZABLE isolation level is not supported.


Member Function Documentation

DbRetVal Connection::close (  ) 

closes connection to the database and releases all the resources

Returns:
DbRetVal

DbRetVal Connection::commit (  ) 

Commits active transaction.

It makes all the changes made in the current transaction permanent and
it also releases the locks held by the current transaction.
After a transaction commits, application is required to start another
transaction for further database operations.

Returns:
DbRetVal

DatabaseManager* Connection::getDatabaseManager (  ) 

gets the database manager object.

Returns:
DatabaseManager

UserManager* Connection::getUserManager (  ) 

gets the user manager object.

Returns:
UserManager

DbRetVal Connection::open ( const char *  username,
const char *  password 
)

opens connection to the database

Parameters:
username username for authentication
password password for authentication
Returns:
DbRetVal

DbRetVal Connection::rollback (  ) 

Aborts the active transaction.

undo all the changes made in the current transaction and it also
releases the locks held by the current transaction.
After a transaction rollback, application is required to start another
transaction for further database operations.

Returns:
DbRetVal

DbRetVal Connection::startTransaction ( IsolationLevel  level = READ_COMMITTED  ) 

Starts a transaction.

The previous transaction should be either committed or rollback
before startTransaction is called.
Application are required to start transaction before they attempt any
database operation.

Returns:
DbRetVal


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