#include <CCalendarDB.h>
Public Member Functions | |
int | setAutocommitOff () |
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, int &iSqliteError) |
bool | sendDBusMessage (string szSendMessage) |
bool | initializeDBus () |
~CCalendarDB () | |
void | InstanceDestroy () |
int | execSQL (const char *pQuery) |
Static Public Member Functions | |
static CCalendarDB * | Instance () |
Private Member Functions | |
CCalendarDB () | |
CCalendarDB (CCalendarDB &calendardb) | |
CCalendarDB & | operator= (CCalendarDB &calendardb) |
void | sem_p (void) |
void | sem_v (void) |
bool | checkTimezoneTable () |
bool | fillTimezoneTable (int &iSqliteError) |
bool | insertTimezoneInfo (string tzId, string location, time_t dtstartStd, time_t dtstartDst, int offsetStd, int offsetDst, int dstflag, string tzname, string rruleStd, string rruleDst) |
Static Private Member Functions | |
static bool | validateDbFile (const std::string &szDbFilename) |
static bool | moveToBackup (const std::string &szDbFilename) |
Private Attributes | |
sqlite3 * | pDb |
DBusConnection * | pBus |
int | sem_id |
Static Private Attributes | |
static CCalendarDB * | pCalendarDb = 0 |
CCalendarDB class
CCalendarDB::~CCalendarDB | ( | ) |
This is the default destructor for CCalendarDB class
CCalendarDB::CCalendarDB | ( | ) | [private] |
None |
None |
CCalendarDB::CCalendarDB | ( | CCalendarDB & | calendardb | ) | [private] |
Dummy copy constructor
int CCalendarDB::setAutocommitOff | ( | ) |
none |
References pDb, and rollbackDB().
Referenced by fillTimezoneTable(), and CMulticalendar::setAutocommitOff().
int CCalendarDB::initDB | ( | ) |
initDB
None |
None |
References checkTimezoneTable(), execSQL(), fillTimezoneTable(), getRecords(), moveToBackup(), pDb, and validateDbFile().
Referenced by Instance().
void CCalendarDB::setApplicationName | ( | string | appName | ) |
setApplicationName Function to set the application name of calling process
string | Application name |
sqlite3 * CCalendarDB::getDb | ( | ) |
getDb
None |
None |
References pDb.
Referenced by CCalendar::addAlarm(), CCalendar::addCacheEntry(), CMulticalendar::addCalendar(), CCalendar::addComponent(), CCalendar::addEventCompDetails(), CMulticalendar::addInstance(), CCalendar::addJournalCompDetails(), CCalendar::addMapTableInfo(), CCalendar::addParameters(), CCalendar::addRecurrence(), CCalendar::addTodoCompDetails(), CCalendar::addXProperties(), CMulticalendar::clearCalendar(), CCalendar::deleteBirthDay(), CMulticalendar::deleteBirthdaysForCalendar(), CCalendar::deleteCacheEntry(), CMulticalendar::deleteCalendar(), CCalendar::deleteEvent(), CCalendar::deleteJournal(), CCalendar::deleteTodo(), CMulticalendar::dropInstances(), execSQL(), insertTimezoneInfo(), Instance(), CCalendar::modifyBirthDay(), CMulticalendar::modifyCalendar(), CCalendar::modifyEvent(), CCalendar::modifyJournal(), CCalendar::modifyRecurrence(), CCalendar::modifyTodo(), and CCalendar::updateTrash().
int CCalendarDB::insertRows | ( | sqlite3_stmt * | pPreparedStmt, | |
int & | iSqliteError | |||
) |
insertRows
preparedStmt: Pointer to prepared statement | ||
int& iSqliteError - place holder for error code from sqlite |
preparedStmt,: | Pointer to prepared statement |
References pDb.
Referenced by CCalendar::addAlarm(), CCalendar::addCacheEntry(), CMulticalendar::addCalendar(), CCalendar::addComponent(), CCalendar::addEventCompDetails(), CMulticalendar::addInstance(), CCalendar::addJournalCompDetails(), CCalendar::addMapTableInfo(), CCalendar::addParameters(), CCalendar::addRecurrence(), CCalendar::addTodoCompDetails(), CCalendar::addXProperties(), insertTimezoneInfo(), and CCalendar::updateTrash().
bool CCalendarDB::updateDB | ( | sqlite3_stmt * | pPreparedStmt, | |
int & | iSqliteError | |||
) |
updateDB
preparedStmt: Pointer to prepared statement | ||
int& iSqliteError - place holder for error code from sqlite |
(preparedStmt) | Pointer to prepared statement |
Referenced by CCalendar::addAlarm(), CCalendar::addComponent(), CMulticalendar::clearCalendar(), CCalendar::deleteBirthDay(), CMulticalendar::deleteBirthdaysForCalendar(), CCalendar::deleteCacheEntry(), CMulticalendar::deleteCalendar(), CCalendar::deleteEvent(), CCalendar::deleteJournal(), CCalendar::deleteTodo(), CMulticalendar::dropInstances(), CCalendar::modifyBirthDay(), CMulticalendar::modifyCalendar(), CCalendar::modifyEvent(), CCalendar::modifyJournal(), CCalendar::modifyRecurrence(), and CCalendar::modifyTodo().
void CCalendarDB::sqliteErrorMapper | ( | int | iSqliteError, | |
int & | pErrorCode | |||
) |
sqliteErrorMapper
iSqliteError | - error obtained from sqlite | |
pErrorCode | - error message thrown to external world |
Referenced by CCalendar::addAlarm(), CCalendar::addBirthDay(), CCalendar::addCacheEntry(), CMulticalendar::addCalendar(), CCalendar::addComponent(), CCalendar::addEventCompDetails(), CMulticalendar::addInstance(), CCalendar::addJournalCompDetails(), CCalendar::addMapTableInfo(), CCalendar::addParameters(), CCalendar::addRecurrence(), CCalendar::addTodoCompDetails(), CCalendar::addXProperties(), CCalendar::checkDuplicateEntry(), CCalendar::checkEntryExist(), CMulticalendar::checkExistenceOfFutureRepeatingEvent(), CCalendar::checkFieldinTable(), CMulticalendar::checkForNextPrev(), CMulticalendar::clearCalendar(), CMulticalendar::deleteAllComponents(), CCalendar::deleteBirthDay(), CMulticalendar::deleteBirthdaysForCalendar(), CCalendar::deleteCacheEntry(), CMulticalendar::deleteCalendar(), CCalendar::deleteComponent(), CCalendar::deleteEvent(), CCalendar::deleteJournal(), CMulticalendar::deleteNonRecurrentComponents(), CCalendar::deleteTodo(), CCalendar::destroyExistingValidAlarms(), CMulticalendar::dropInstances(), CCalendar::getAllDeletedItems(), CCalendar::getAllEventsTodos(), CCalendar::getBirthDayEvent(), CCalendar::getCacheTableCount(), CMulticalendar::getCalendarIdForComponent(), CCalendar::getChangeIds(), CMulticalendar::getComponentCount(), CCalendar::getComponents(), CMulticalendar::getComponentsAllCalendars(), CMulticalendar::getComponentsWithLimitedData(), CCalendar::getCookie(), CMulticalendar::getCount(), CMulticalendar::getDateRange(), CCalendar::getEvent(), CMulticalendar::getEventInList(), CCalendar::getEvents(), CCalendar::getExternalToLocalId(), CCalendar::getIdList(), CMulticalendar::getInstanceNumber(), CCalendar::getJournal(), CCalendar::getJournals(), CMulticalendar::getLatestComponent(), CMulticalendar::getNumOfAllDayEventsForToday(), CMulticalendar::getNumOfUndoneTasks(), CMulticalendar::getPrevNextComponent(), CCalendar::getRecursiveEventsInRange(), CMulticalendar::getTodaysAllDay(), CCalendar::getTodo(), CCalendar::getTodos(), CMulticalendar::getVisibleCalendarCount(), CMulticalendar::giveExpiredEntries(), CMulticalendar::giveRecursiveExpiredEvents(), insertTimezoneInfo(), CMulticalendar::localBdayEventFromRemoteId(), CCalendar::modifyBirthDay(), CMulticalendar::modifyCalendar(), CCalendar::modifyEvent(), CCalendar::modifyJournal(), CCalendar::modifyRecurrence(), CCalendar::modifyTodo(), CCalendar::registerAlarmForVisibleCalendar(), CCalendar::updateTrash(), and CComponent::updateUntilInDB().
bool CCalendarDB::rollbackDB | ( | ) |
rollbackDB
None |
None |
References pDb.
Referenced by commitDB(), CMulticalendar::rollbackAllChanges(), and setAutocommitOff().
bool CCalendarDB::commitDB | ( | string | szMessage | ) |
commitDB
None |
None |
References pDb, rollbackDB(), and sendDBusMessage().
Referenced by CMulticalendar::commitAllChanges(), and fillTimezoneTable().
bool CCalendarDB::closeDB | ( | ) |
closeDB
None |
None |
References pDb.
Referenced by CMulticalendar::~CMulticalendar().
QueryResult * CCalendarDB::getRecords | ( | char * | pQuery, | |
int & | iSqliteError | |||
) |
getRecords
query: sql statement in form of query. | ||
int& reference to error code. |
(query) | sql statement in form of query. |
References pDb.
Referenced by CCalendar::checkDuplicateEntry(), CCalendar::checkEntryExist(), CMulticalendar::checkExistenceOfFutureRepeatingEvent(), CCalendar::checkFieldinTable(), CMulticalendar::checkForNextPrev(), checkTimezoneTable(), CMulticalendar::deleteAllComponents(), CCalendar::deleteComponent(), CMulticalendar::deleteNonRecurrentComponents(), CCalendar::destroyExistingValidAlarms(), CComponent::getAlarmProperties(), CCalendar::getAllDeletedItems(), CCalendar::getAllEventsTodos(), CCalendar::getBirthDayEvent(), CCalendar::getCacheTableCount(), CMulticalendar::getCalendarById(), CMulticalendar::getCalendarIdForComponent(), CCalendar::getChangeIds(), CMulticalendar::getComponentCount(), CCalendar::getComponents(), CMulticalendar::getComponentsAllCalendars(), CMulticalendar::getComponentsWithLimitedData(), CCalendar::getCookie(), CMulticalendar::getCount(), CMulticalendar::getDateRange(), CCalendar::getEvent(), CMulticalendar::getEventInList(), CCalendar::getEvents(), CCalendar::getExternalToLocalId(), CCalendar::getIdList(), CMulticalendar::getInstanceNumber(), CCalendar::getJournal(), CCalendar::getJournals(), CMulticalendar::getLatestComponent(), CMulticalendar::getListCalFromMc(), CMulticalendar::getNumOfAllDayEventsForToday(), CMulticalendar::getNumOfUndoneTasks(), CComponentDetails::getParameter(), CMulticalendar::getPrevNextComponent(), CComponentDetails::getPropertyValues(), CComponent::getRecurrenceProperties(), CCalendar::getRecursiveEventsInRange(), CMulticalendar::getTodaysAllDay(), CCalendar::getTodo(), CCalendar::getTodos(), CMulticalendar::getVisibleCalendarCount(), CMulticalendar::giveExpiredEntries(), CMulticalendar::giveRecursiveExpiredEvents(), initDB(), CMulticalendar::localBdayEventFromRemoteId(), CCalendar::registerAlarmForVisibleCalendar(), CMulticalendar::restoreAlarms(), CComponentDetails::retrieveParameterDetails(), CComponentDetails::retrieveXPropertyDetails(), and CCalendar::updateTrash().
CCalendarDB * CCalendarDB::Instance | ( | ) | [static] |
Instance
None |
None |
References getDb(), initDB(), and pCalendarDb.
Referenced by CCalendar::addAlarm(), CCalendar::addAttendeeDetails(), CCalendar::addBirthDay(), CCalendar::addCacheEntry(), CMulticalendar::addCalendar(), CCalendar::addComponent(), CCalendar::addEventCompDetails(), CMulticalendar::addInstance(), CCalendar::addJournalCompDetails(), CCalendar::addMapTableInfo(), CCalendar::addOrganizer(), CCalendar::addParameters(), CCalendar::addRecurrence(), CCalendar::addTodoCompDetails(), CCalendar::addXProperties(), CCalendar::checkDuplicateEntry(), CCalendar::checkEntryExist(), CMulticalendar::checkExistenceOfFutureRepeatingEvent(), CCalendar::checkFieldinTable(), CMulticalendar::checkForNextPrev(), CMulticalendar::clearCalendar(), CMulticalendar::commitAllChanges(), CMulticalendar::deleteAllComponents(), CCalendar::deleteBirthDay(), CMulticalendar::deleteBirthdaysForCalendar(), CCalendar::deleteCacheEntry(), CMulticalendar::deleteCalendar(), CCalendar::deleteComponent(), CMulticalendar::deleteComponents(), CCalendar::deleteEvent(), CCalendar::deleteJournal(), CMulticalendar::deleteNonRecurrentComponents(), CCalendar::deleteTodo(), CCalendar::destroyExistingValidAlarms(), CMulticalendar::dropInstances(), CMulticalendar::enableAutomaticDeletion(), CComponent::getAlarmProperties(), CCalendar::getAllDeletedItems(), CCalendar::getAllEventsTodos(), CCalendar::getBirthDayEvent(), CCalendar::getCacheTableCount(), CMulticalendar::getCalendarById(), CMulticalendar::getCalendarIdForComponent(), CCalendar::getChangeIds(), CMulticalendar::getComponentCount(), CCalendar::getComponents(), CMulticalendar::getComponentsAllCalendars(), CMulticalendar::getComponentsAllCalendarsBySummary(), CMulticalendar::getComponentsWithLimitedData(), CCalendar::getCookie(), CMulticalendar::getCount(), CMulticalendar::getDateRange(), CCalendar::getEvent(), CMulticalendar::getEventInList(), CCalendar::getEvents(), CCalendar::getExternalToLocalId(), CCalendar::getIdList(), CMulticalendar::getInstanceNumber(), CMulticalendar::getInstances(), CCalendar::getJournal(), CCalendar::getJournals(), CMulticalendar::getLatestComponent(), CMulticalendar::getListCalFromMc(), CMulticalendar::getNumOfAllDayEventsForToday(), CMulticalendar::getNumOfUndoneTasks(), CComponentDetails::getParameter(), CMulticalendar::getPrevNextComponent(), CComponentDetails::getPropertyValues(), CComponent::getRecurrenceProperties(), CCalendar::getRecursiveEventsInRange(), CMulticalendar::getTodaysAllDay(), CCalendar::getTodo(), CCalendar::getTodos(), CMulticalendar::getVisibleCalendarCount(), CMulticalendar::giveExpiredEntries(), CMulticalendar::giveRecursiveExpiredEvents(), CMulticalendar::localBdayEventFromRemoteId(), CCalendar::modifyBirthDay(), CMulticalendar::modifyCalendar(), CCalendar::modifyEvent(), CCalendar::modifyJournal(), CCalendar::modifyRecurrence(), CCalendar::modifyTodo(), CMulticalendar::regenerateInstances(), CCalendar::registerAlarmForVisibleCalendar(), CMulticalendar::restoreAlarms(), CComponentDetails::retrieveParameterDetails(), CComponentDetails::retrieveXPropertyDetails(), CMulticalendar::rollbackAllChanges(), CMulticalendar::setAutocommitOff(), CCalendar::updateTrash(), CComponent::updateUntilInDB(), and CMulticalendar::~CMulticalendar().
bool CCalendarDB::sendDBusMessage | ( | string | szSendMessage | ) |
sendDBusMessage Send the DBusMessage over the session bus
string | Message to send |
References CMulticalendar::getApplicationName(), CMulticalendar::MCInstance(), and pBus.
Referenced by commitDB(), and CMulticalendar::deleteComponents().
int CCalendarDB::execSQL | ( | const char * | pQuery | ) |
execSQL
(pQquery) | sql statement in form of query. |
References getDb(), and pCalendarDb.
Referenced by CMulticalendar::clearCalendar(), fillTimezoneTable(), initDB(), CMulticalendar::regenerateInstances(), and CComponent::updateUntilInDB().
CCalendarDB & CCalendarDB::operator= | ( | CCalendarDB & | calendardb | ) | [private] |
Dummy assignment operator
bool CCalendarDB::validateDbFile | ( | const std::string & | szDbFilename | ) | [static, private] |
Validate and backup Database file if corrupted
szDbFilename | filename if SQlite3 databsae storage file to check. |
Referenced by initDB().
bool CCalendarDB::moveToBackup | ( | const std::string & | szDbFilename | ) | [static, private] |
Make a backup copy of Database file
szDbFilename | file to backup |
Referenced by initDB().
bool CCalendarDB::checkTimezoneTable | ( | ) | [private] |
Check TIMEZONE table presence
References getRecords().
Referenced by initDB().
bool CCalendarDB::fillTimezoneTable | ( | int & | iSqliteError | ) | [private] |
Fill TIMEZONE table using build-in timzone information
iSqliteError |
References commitDB(), execSQL(), insertTimezoneInfo(), and setAutocommitOff().
Referenced by initDB().
bool CCalendarDB::insertTimezoneInfo | ( | string | tzId, | |
string | location, | |||
time_t | dtstartStd, | |||
time_t | dtstartDst, | |||
int | offsetStd, | |||
int | offsetDst, | |||
int | dstflag, | |||
string | tzname, | |||
string | rruleStd, | |||
string | rruleDst | |||
) | [private] |
Add one timezone record into TIMEZONE table
tzId | ||
location | ||
dtstartStd | ||
dtstartDst | ||
offsetStd | ||
offsetDst | ||
dstflag | ||
tzname | ||
rruleStd | ||
rruleDst |
References getDb(), insertRows(), and sqliteErrorMapper().
Referenced by fillTimezoneTable().
sqlite3* CCalendarDB::pDb [private] |
SQLite database pointer
Referenced by CCalendarDB(), closeDB(), commitDB(), getDb(), getRecords(), initDB(), insertRows(), rollbackDB(), and setAutocommitOff().
DBusConnection* CCalendarDB::pBus [private] |
DBus Connection pointer
Referenced by CCalendarDB(), and sendDBusMessage().
CCalendarDB * CCalendarDB::pCalendarDb = 0 [static, private] |
Static CCalendarDB pointer for singleton usage
Initialising CCalendarDB global pointer to 0
Referenced by execSQL(), and Instance().