summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2019-06-10 03:28:54 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2019-06-10 03:28:54 +0300
commitce537385656872ea2971bf5a28727a5d6cdc1cb6 (patch)
tree81a2057eca1d666e2e6a5da0d4c51583d3f1f223 /plugins/Dbx_sqlite
parent9f40e8aa80525dcf0343ffa82cb137a6f3d8b258 (diff)
dbx_sqlite: fixed a lot iof typos
//i was a bit too much sleepy, sorry )
Diffstat (limited to 'plugins/Dbx_sqlite')
-rwxr-xr-xplugins/Dbx_sqlite/src/dbevents.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index d8d12b02dc..e4492410cd 100755
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -430,6 +430,8 @@ MEVENT CDbxSQLite::FindFirstEvent(MCONTACT hContact)
if (cc->m_first)
return cc->m_first;
+ evt_cnt_fwd = hContact;
+
mir_cslock lock(m_csDbAccess);
if (evt_cur_fwd)
@@ -441,11 +443,11 @@ MEVENT CDbxSQLite::FindFirstEvent(MCONTACT hContact)
sqlite3_bind_int64(evt_cur_fwd, 1, hContact);
int rc = sqlite3_step(evt_cur_fwd);
assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
- evt_cnt_fwd = hContact;
-/* if (rc != SQLITE_ROW) {
+ if (rc != SQLITE_ROW) {
sqlite3_reset(evt_cur_fwd);
+ evt_cur_fwd = 0;
return 0;
- } */
+ }
cc->m_first = sqlite3_column_int64(evt_cur_fwd, 0);
cc->m_firstTimestamp = sqlite3_column_int64(evt_cur_fwd, 1);
return cc->m_first;
@@ -517,6 +519,8 @@ MEVENT CDbxSQLite::FindLastEvent(MCONTACT hContact)
if (cc->m_last)
return cc->m_last;
+ evt_cnt_backwd = hContact;
+
mir_cslock lock(m_csDbAccess);
if (evt_cur_backwd)
@@ -528,10 +532,9 @@ MEVENT CDbxSQLite::FindLastEvent(MCONTACT hContact)
sqlite3_bind_int64(evt_cur_backwd, 1, hContact);
int rc = sqlite3_step(evt_cur_backwd);
assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
- evt_cnt_backwd = hContact;
if (rc != SQLITE_ROW) {
- sqlite3_reset(evt_cur_fwd);
- evt_cur_fwd = 0;
+ sqlite3_reset(evt_cur_backwd);
+ evt_cur_backwd = 0;
return 0;
}
cc->m_last = sqlite3_column_int64(evt_cur_backwd, 0);
@@ -564,6 +567,7 @@ MEVENT CDbxSQLite::FindNextEvent(MCONTACT hContact, MEVENT hDbEvent)
if (rc == SQLITE_DONE)
{
sqlite3_reset(evt_cur_fwd);
+ evt_cur_fwd = 0;
return 0;
}
}
@@ -589,7 +593,7 @@ MEVENT CDbxSQLite::FindPrevEvent(MCONTACT hContact, MEVENT hDbEvent)
if (cc == nullptr)
return 0;
- if (!evt_cur_fwd)
+ if (!evt_cur_backwd)
{
return 0;
}
@@ -605,6 +609,7 @@ MEVENT CDbxSQLite::FindPrevEvent(MCONTACT hContact, MEVENT hDbEvent)
if (rc == SQLITE_DONE)
{
sqlite3_reset(evt_cur_backwd);
+ evt_cur_backwd = 0;
return 0;
}
}
@@ -612,8 +617,8 @@ MEVENT CDbxSQLite::FindPrevEvent(MCONTACT hContact, MEVENT hDbEvent)
int rc = sqlite3_step(evt_cur_backwd);
assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
if (rc != SQLITE_ROW) {
- sqlite3_reset(evt_cur_fwd);
- evt_cur_fwd = 0;
+ sqlite3_reset(evt_cur_backwd);
+ evt_cur_backwd = 0;
return 0;
}
hDbEvent = sqlite3_column_int64(evt_cur_backwd, 0);