SqlConnection Class Reference

#include <SqlConnection.h>

Inheritance diagram for SqlConnection:

Inheritance graph
[legend]
Collaboration diagram for SqlConnection:

Collaboration graph
[legend]

Public Member Functions

 SqlConnection ()
DbRetVal connect (char *user, char *pass)
 opens connection to the sql engine
DbRetVal disconnect ()
 closes connection to the database and releases all the resources
DbRetVal commit ()
 Commits active transaction.
DbRetVal rollback ()
 Aborts the active transaction.
DbRetVal beginTrans (IsolationLevel isoLevel=READ_COMMITTED, TransSyncMode mode=OSYNC)
 Starts a transaction.
ConnectiongetConnObject ()
bool isConnectionOpen ()

Friends

class SqlFactory

Detailed Description

Definition at line 26 of file SqlConnection.h.


Constructor & Destructor Documentation

SqlConnection::SqlConnection (  )  [inline]

Definition at line 31 of file SqlConnection.h.

References AbsSqlConnection::innerConn.

00031 {innerConn = NULL; isConnOpen = false; }


Member Function Documentation

DbRetVal SqlConnection::beginTrans ( IsolationLevel  isoLevel = READ_COMMITTED,
TransSyncMode  mode = OSYNC 
) [inline, virtual]

Starts a transaction.

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

Parameters:
isoLevel isolation level. Default is read committed.
Returns:
DbRetVal

Implements AbsSqlConnection.

Definition at line 79 of file SqlConnection.h.

References isoLevel, and Connection::startTransaction().

Referenced by main().

00081         { return conn.startTransaction(isoLevel); }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal SqlConnection::commit (  )  [inline, virtual]

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

Implements AbsSqlConnection.

Definition at line 60 of file SqlConnection.h.

References Connection::commit().

Referenced by main().

00060 { return conn.commit(); }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal SqlConnection::connect ( char *  user,
char *  pass 
) [inline, virtual]

opens connection to the sql engine

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

Implements AbsSqlConnection.

Definition at line 38 of file SqlConnection.h.

References OK, and Connection::open().

Referenced by main().

00038                                                {
00039         DbRetVal ret = conn.open(user, pass);
00040         if (ret == OK) isConnOpen = true;
00041         return ret;
00042     }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal SqlConnection::disconnect (  )  [inline, virtual]

closes connection to the database and releases all the resources

Returns:
DbRetVal

Implements AbsSqlConnection.

Definition at line 47 of file SqlConnection.h.

References Connection::close(), and OK.

Referenced by main().

00047                            { 
00048         DbRetVal ret = conn.close(); 
00049         if (ret == OK) isConnOpen = false;
00050         return ret;
00051     }

Here is the call graph for this function:

Here is the caller graph for this function:

Connection& SqlConnection::getConnObject (  )  [inline, virtual]

Implements AbsSqlConnection.

Definition at line 83 of file SqlConnection.h.

Referenced by SqlStatement::prepare().

00083 {  return conn; }

Here is the caller graph for this function:

bool SqlConnection::isConnectionOpen (  )  [inline]

Definition at line 84 of file SqlConnection.h.

Referenced by SqlStatement::execute(), SqlStatement::fetch(), SqlStatement::fetchAndPrint(), and SqlStatement::prepare().

00084 { if (isConnOpen) return true; return false; };

Here is the caller graph for this function:

DbRetVal SqlConnection::rollback (  )  [inline, virtual]

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

Implements AbsSqlConnection.

Definition at line 69 of file SqlConnection.h.

References Connection::rollback().

00069 { return conn.rollback(); }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class SqlFactory [friend]

Definition at line 84 of file SqlConnection.h.


The documentation for this class was generated from the following file:
Generated on Mon Jun 9 22:51:15 2008 for csql by  doxygen 1.4.7