From 8cb2a99e08a3f8fadc3b39f00228efa7d2b20050 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 3 Oct 2012 18:27:17 +0000 Subject: database cache migration, phase 1 git-svn-id: http://svn.miranda-ng.org/main/trunk@1772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/dbintf.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/modules/database/dbintf.cpp') diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp index 6c6371e6ec..da83e284d2 100644 --- a/src/modules/database/dbintf.cpp +++ b/src/modules/database/dbintf.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" +#include "database.h" MIDatabase *currDb = NULL; DATABASELINK *currDblink = NULL; @@ -191,6 +192,24 @@ static INT_PTR srvGetCurrentDb(WPARAM wParam,LPARAM lParam) return (INT_PTR)currDb; } +static INT_PTR srvInitInstance(WPARAM wParam,LPARAM lParam) +{ + MIDatabase* pDb = (MIDatabase*)lParam; + if (pDb != NULL) + pDb->m_cache = new MDatabaseCache(); + return 0; +} + +static INT_PTR srvDestroyInstance(WPARAM wParam,LPARAM lParam) +{ + MIDatabase* pDb = (MIDatabase*)lParam; + if (pDb != NULL) { + delete pDb->m_cache; + pDb->m_cache = NULL; + } + return 0; +} + /////////////////////////////////////////////////////////////////////////////// int LoadDbintfModule() @@ -232,5 +251,8 @@ int LoadDbintfModule() CreateServiceFunction(MS_DB_REGISTER_PLUGIN, srvRegisterPlugin); CreateServiceFunction(MS_DB_FIND_PLUGIN, srvFindPlugin); CreateServiceFunction(MS_DB_GET_CURRENT, srvGetCurrentDb); + + CreateServiceFunction(MS_DB_INIT_INSTANCE, srvInitInstance); + CreateServiceFunction(MS_DB_DESTROY_INSTANCE, srvDestroyInstance); return 0; } -- cgit v1.2.3