include/CCalendarDB.h

Go to the documentation of this file.
00001 
00023 #ifndef __CALDB_H__
00024 #define __CALDB_H__
00025 
00026 /* SQlite header file */
00027 #include <sqlite3.h>
00028 
00029 /* Headers for DBUS */
00030 #include <dbus/dbus.h>
00031 
00032 #include <string>
00033 using namespace std;
00034 using std::string;
00035 
00036 /* Structure to hold the data which was fetched from database and
00037  * to pass them to the higher level*/
00038 
00039 typedef struct _QueryResult QueryResult;
00040 
00041 struct _QueryResult {
00042   public:
00043     char **pResult;
00044     int iRow;
00045     int iColumn;
00046 };
00047 
00053 class CCalendarDB {
00054 
00055   private:
00056 
00057     sqlite3 * pDb; 
00059     DBusConnection *pBus; 
00061     static CCalendarDB *pCalendarDb; 
00064   public:
00065 
00074     int initDB();
00075 
00085     void setApplicationName (string appName);
00086 
00093     sqlite3 *getDb();
00094 
00103     int insertRows(sqlite3_stmt* preparedStmt,int& iSqliteError);
00104 
00112     bool updateDB(sqlite3_stmt * preparedStmt,int& iSqliteError);
00121     void sqliteErrorMapper(int iSqliteError, int& pErrorCode );
00122 
00123 
00130     bool rollbackDB();
00131 
00138     bool commitDB(string szMessage);
00139 
00146     bool closeDB();
00147 
00154     QueryResult *getRecords(char *pQuery);
00155 
00164     static CCalendarDB *Instance();
00165 
00166 
00167     bool sendDBusMessage (string szSendMessage);
00168 
00169     bool initializeDBus ();
00170 
00171     //Destructor
00172     ~CCalendarDB();
00173 
00174   private:
00175 
00183      CCalendarDB();
00184 
00185     //Copy constructor dummy so that 
00186     //multiple instances are not created
00187      CCalendarDB(CCalendarDB & calendardb);
00188 
00189     // Overloading for assignment operator
00190      CCalendarDB & operator=(CCalendarDB & calendardb);
00191 
00192 };
00193 
00194 
00195 #endif

Generated on Tue Feb 24 16:21:31 2009 for calendar-backend by  doxygen 1.5.1