Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CalendarDataStorage: Fixed existing account check and removed debug text
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 14 Feb 2017 01:33:33 +0000 (01:33 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 14 Feb 2017 01:33:33 +0000 (01:33 +0000)
source/libraries/CalendarDataStorage/CalendarDataStorage.cpp

index 63c8a3e..d6d335e 100644 (file)
@@ -558,7 +558,7 @@ CDSCalendarResult CalendarDataStorage::AddCalendar(int accountID, string calenda
        
        resultCode = sqlite3_step(findHandle);
        
-       if (resultCode != SQLITE_DONE){
+       if (resultCode != SQLITE_ROW){
                return CDSCALENDAR_NOACCOUNT;
        }       
        
@@ -1848,11 +1848,11 @@ CDSEditEntryResult CalendarDataStorage::UpdateEvent(int eventID, std::string fil
        std::string sqlParameter = "UPDATE calendarentries SET entryname=(?2), entrydescription=(?3),"
        " entrystartyear=(?4), entrystartmonth=(?5), entrystartday=(?6), entrystarthour=(?7), entrystartminute=(?8), entrystartsecond=(?9),"
        " entryendyear=(?10), entryendmonth=(?11), entryendday=(?12), entryendhour=(?13), entryendminute=(?14), entryendsecond=(?15), "
-       " entrydurationweek=(?16), entrydurationday=(?17), entrydurationhour=(?18), entrydurationminute=(?19), entrydurationsecond=(?20), "
+       " entrydurationweek=(?16), entrydurationday=(?17), entrydurationhour=(?18), entrydurationminute=(?19), entrydurationsecond=(?20) "
        " WHERE id=(?1)";
        
        resultCode = sqlite3_prepare_v2(db, sqlParameter.c_str(), -1, &statementHandle, nullptr);
-
+       
        resultCode = sqlite3_bind_int(statementHandle, 1, eventID);
        
        if (resultCode != 0){
@@ -2621,85 +2621,72 @@ CDSCleanupResult CalendarDataStorage::Clear(){
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM calendarentries", -    1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 1" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 2" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM sqlite_sequence WHERE name='calendarentries';", -1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 3" << endl;
-               cout << sqlite3_errmsg(db) << endl;
                return CDSCLEANUP_FAILED;
        }
 
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 4" << endl;
                return CDSCLEANUP_FAILED;
        }
 
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM calendars", -1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 5" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 6" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM sqlite_sequence WHERE name='calendars';", -1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 7" << endl;
                return CDSCLEANUP_FAILED;
        }
 
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 8" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM accounts", -1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 9" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 10" << endl;
                return CDSCLEANUP_FAILED;
        }
        
        resultCode = sqlite3_prepare_v2(db, "DELETE FROM sqlite_sequence WHERE name='accounts'", -1, &statementHandle, nullptr);
        
        if (resultCode != 0){
-               cout << "Fail 11" << endl;
                return CDSCLEANUP_FAILED;
        }
 
        resultCode = sqlite3_step(statementHandle);
        
        if (resultCode != SQLITE_DONE){
-               cout << "Fail 12" << endl;
                return CDSCLEANUP_FAILED;
        }
        
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy