summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-14 12:34:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-14 12:34:32 +0300
commit5a09915186e4ae70cc39e9343ca02a1b860d7f94 (patch)
treeba115287c182bc8dae3308fc23f8d197d68850cb /src
parent2b30685427500c9eedac4c0c4862b32af144a90c (diff)
simple database event cycles moved to cursors
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/db.cpp29
-rw-r--r--src/mir_core/src/mir_core.def5
-rw-r--r--src/mir_core/src/mir_core64.def5
3 files changed, 39 insertions, 0 deletions
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 50df1e3e83..62fd662b35 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -453,6 +453,35 @@ MIR_CORE_DLL(DB::EventCursor*) DB::EventsRev(MCONTACT hContact, MEVENT iStartEve
return (currDb == nullptr) ? 0 : currDb->EventCursorRev(hContact, iStartEvent);
}
+DB::ECPTR::ECPTR(EventCursor *_pCursor) :
+ m_cursor(_pCursor),
+ m_prevFetched(-1),
+ m_currEvent(0)
+{
+}
+
+DB::ECPTR::~ECPTR()
+{
+ delete m_cursor;
+}
+
+void DB::ECPTR::DeleteEvent()
+{
+ m_prevFetched = m_cursor->FetchNext();
+ db_event_delete(m_currEvent);
+}
+
+MEVENT DB::ECPTR::FetchNext()
+{
+ if (m_prevFetched != -1) {
+ m_currEvent = m_prevFetched;
+ m_prevFetched = -1;
+ }
+ else m_currEvent = m_cursor->FetchNext();
+
+ return m_currEvent;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// misc functions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index a89c1757ff..6ccd0c16b5 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1466,3 +1466,8 @@ XmlGetChildText @1645
?begin@EventCursor@DB@@QAEIXZ @1690 NONAME
?end@EventCursor@DB@@QAEIXZ @1691 NONAME
TimeZone_GetSystemTime @1692
+??0ECPTR@DB@@QAE@PAVEventCursor@1@@Z @1693 NONAME
+??1ECPTR@DB@@QAE@XZ @1694 NONAME
+??4EventCursor@DB@@QAEAAV01@ABV01@@Z @1695 NONAME
+?DeleteEvent@ECPTR@DB@@QAEXXZ @1696 NONAME
+?FetchNext@ECPTR@DB@@QAEIXZ @1697 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index e98319e623..9779067440 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1466,3 +1466,8 @@ XmlGetChildText @1645
?begin@EventCursor@DB@@QEAAIXZ @1690 NONAME
?end@EventCursor@DB@@QEAAIXZ @1691 NONAME
TimeZone_GetSystemTime @1692
+??0ECPTR@DB@@QEAA@PEAVEventCursor@1@@Z @1693 NONAME
+??1ECPTR@DB@@QEAA@XZ @1694 NONAME
+??4EventCursor@DB@@QEAAAEAV01@AEBV01@@Z @1695 NONAME
+?DeleteEvent@ECPTR@DB@@QEAAXXZ @1696 NONAME
+?FetchNext@ECPTR@DB@@QEAAIXZ @1697 NONAME