CCalendarDB Class Reference

This class contains core API's to interact with SQLite database. It will perform the query operations in the database. More...

#include <CCalendarDB.h>


Public Member Functions

int initDB ()
void setApplicationName (string appName)
sqlite3 * getDb ()
int insertRows (sqlite3_stmt *preparedStmt, int &iSqliteError)
bool updateDB (sqlite3_stmt *preparedStmt, int &iSqliteError)
void sqliteErrorMapper (int iSqliteError, int &pErrorCode)
bool rollbackDB ()
bool commitDB (string szMessage)
bool closeDB ()
QueryResult * getRecords (char *pQuery)
bool sendDBusMessage (string szSendMessage)
bool initializeDBus ()
 ~CCalendarDB ()

Static Public Member Functions

static CCalendarDBInstance ()

Private Member Functions

 CCalendarDB ()
 CCalendarDB (CCalendarDB &calendardb)
CCalendarDBoperator= (CCalendarDB &calendardb)

Private Attributes

sqlite3 * pDb
DBusConnection * pBus

Static Private Attributes

static CCalendarDBpCalendarDb


Detailed Description

This class contains core API's to interact with SQLite database. It will perform the query operations in the database.

CCalendarDB class


Constructor & Destructor Documentation

CCalendarDB::~CCalendarDB (  ) 

This is the default destructor for CCalendarDB class

CCalendarDB::CCalendarDB (  )  [private]

CCalendarDB

Parameters:
 None
Returns:
: None This function is constructor for CCalendarDB class and will be called when ever object of this class is created.

CCalendarDB::CCalendarDB ( CCalendarDB calendardb  )  [private]

Dummy copy constructor


Member Function Documentation

int CCalendarDB::initDB (  ) 

initDB

Parameters:
None 
Returns:
: int database intialization status This function Creates database file in ~/.calenadar/calenadrdb if it is not present. If DB file already exists then it opens the file for DB transactions. Also responsible for creation of all DB tables if they are not present in DB.

void CCalendarDB::setApplicationName ( string  appName  ) 

setApplicationName Function to set the application name of calling process

Parameters:
string Application name
Returns:
void

sqlite3 * CCalendarDB::getDb (  ) 

getDb

Parameters:
 None
Returns:
:sqlite3* Pointer to DB This function returns DB pointer( here sqlite3*)

int CCalendarDB::insertRows ( sqlite3_stmt *  preparedStmt,
int &  iSqliteError 
)

insertRows

Parameters:
 preparedStmt: Pointer to prepared statement
 int& iSqliteError - place holder for error code from sqlite
Returns:
: int : Id of the inserted Row (so that functions at higher levels can make a note of ID added) This function returns ID of the new row inserted. Function is used to add new rows in all tables.(EVETN ,TODO and JOURNAL)

bool CCalendarDB::updateDB ( sqlite3_stmt *  preparedStmt,
int &  iSqliteError 
)

updateDB

Parameters:
 preparedStmt: Pointer to prepared statement
 int& iSqliteError - place holder for error code from sqlite
Returns:
: bool : status of the DB transaction Function is used to modify rows in all tables.(EVETN ,TODO and JOURNAL)

void CCalendarDB::sqliteErrorMapper ( int  iSqliteError,
int &  pErrorCode 
)

sqliteErrorMapper

Parameters:
iSqliteError - error obtained from sqlite
pErrorCode - error message thrown to external world
Returns:
void
Function to Map sqlite error to external error

bool CCalendarDB::rollbackDB (  ) 

rollbackDB

Parameters:
 None
Returns:
: bool : status of the rollback operation Function is used to rollback in case of inconsistency in DB transaction?

bool CCalendarDB::commitDB ( string  szMessage  ) 

commitDB

Parameters:
 None
Returns:
: bool : status of the commit operation Function is used to commit DB transaction?

bool CCalendarDB::closeDB (  ) 

closeDB

Parameters:
 None
Returns:
: bool : status of the DB close Function is used to close DB file.

QueryResult * CCalendarDB::getRecords ( char *  pQuery  ) 

getRecords

Parameters:
 query: sql statement in form of query.
Returns:
: QueryResult : result of query is obtained in QueryResult structure Function is used to get result from a query.

CCalendarDB * CCalendarDB::Instance (  )  [static]

Instance

Parameters:
 None
Returns:
: CCalendarDB* This function is used to create instance of CCalendarDB class, since CCalendarDB is declared as singleton class-(constructor is declared as private ) when ever object of this class needs to be created Instance is to be called.

bool CCalendarDB::sendDBusMessage ( string  szSendMessage  ) 

sendDBusMessage Send the DBusMessage over the session bus

Parameters:
string Message to send
Returns:
TRUE/FALSE

CCalendarDB & CCalendarDB::operator= ( CCalendarDB calendardb  )  [private]

Dummy assignment operator


Field Documentation

sqlite3* CCalendarDB::pDb [private]

SQLite database pointer

DBusConnection* CCalendarDB::pBus [private]

DBus Connection pointer

CCalendarDB * CCalendarDB::pCalendarDb [static, private]

Static CCalendarDB pointer for singleton usage


The documentation for this class was generated from the following files:
Generated on Tue Feb 24 16:21:33 2009 for calendar-backend by  doxygen 1.5.1