summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/dbintf.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-27 15:33:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-27 15:33:58 +0000
commitdf77e258df8cec689a001ec92031538298661b1b (patch)
tree56ec236ca9675f049c4806e8d41986c40b537f07 /plugins/Db3x_mmap/src/dbintf.cpp
parent414ffc78d69f09d48fc43051e0806a30e8fb5c67 (diff)
merge of dbtool & database plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@1213 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbintf.cpp')
-rw-r--r--plugins/Db3x_mmap/src/dbintf.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp
index 0479be3691..84ddc64468 100644
--- a/plugins/Db3x_mmap/src/dbintf.cpp
+++ b/plugins/Db3x_mmap/src/dbintf.cpp
@@ -94,6 +94,9 @@ CDb3Base::~CDb3Base()
UnmapViewOfFile(m_pDbCache);
}
+ if (m_hMap)
+ CloseHandle(m_hMap);
+
// update profile last modified time
DWORD bytesWritten;
SetFilePointer(m_hDbFile, 0, NULL, FILE_BEGIN);
@@ -168,3 +171,34 @@ void CDb3Base::DecodeDBWrite(DWORD ofs, void *src, int size)
DBWrite(ofs, src, size);
}
+///////////////////////////////////////////////////////////////////////////////
+// MIDatabaseChecker
+
+static CheckWorker Workers[6] =
+{
+ &CDb3Base::WorkInitialChecks,
+ &CDb3Base::WorkModuleChain,
+ &CDb3Base::WorkUser,
+ &CDb3Base::WorkContactChain,
+ &CDb3Base::WorkAggressive,
+ &CDb3Base::WorkFinalTasks
+};
+
+int CDb3Base::Start(DBCHeckCallback *callback)
+{
+ cb = callback;
+ return ERROR_SUCCESS;
+}
+
+int CDb3Base::CheckDb(int phase, int firstTime)
+{
+ if (phase >= SIZEOF(Workers))
+ return ERROR_OUT_OF_PAPER;
+
+ return (this->*Workers[phase])(firstTime);
+}
+
+void CDb3Base::Destroy()
+{
+ delete this;
+}