From b604cc6ce09143a994ca364684cd276f78bd33da Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 14 Feb 2017 01:33:33 +0000 Subject: [PATCH] CalendarDataStorage: Fixed existing account check and removed debug text --- .../CalendarDataStorage.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp b/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp index 63c8a3e..d6d335e 100644 --- a/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp +++ b/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp @@ -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; } -- 2.39.5