summaryrefslogtreecommitdiff
path: root/include/m_db_int.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-03 18:27:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-03 18:27:17 +0000
commit8cb2a99e08a3f8fadc3b39f00228efa7d2b20050 (patch)
tree65576462073546d462936d7ad8a2aa3e4e6147d8 /include/m_db_int.h
parentd2da1f079fc61195437007882296184714d2fe54 (diff)
database cache migration, phase 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@1772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_db_int.h')
-rw-r--r--include/m_db_int.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h
index df6671a486..cd498c5330 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -31,8 +31,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
///////////////////////////////////////////////////////////////////////////////
// basic database interface
+struct DBCachedGlobalValue
+{
+ char* name;
+ DBVARIANT value;
+};
+
+struct DBCachedContactValue
+{
+ char* name;
+ DBVARIANT value;
+ DBCachedContactValue* next;
+};
+
+struct DBCachedContact
+{
+ HANDLE hContact;
+ HANDLE hNext;
+ DBCachedContactValue* first;
+ DBCachedContactValue* last;
+};
+
+interface MIDatabaseCache
+{
+ STDMETHOD_(DBCachedContact*,AddContactToCache)(HANDLE hContact) PURE;
+ STDMETHOD_(DBCachedContact*,GetCachedContact)(HANDLE hContact) PURE;
+ STDMETHOD_(void,FreeCachedContact)(HANDLE hContact) PURE;
+
+ STDMETHOD_(char*,InsertCachedSetting)(const char *szName, int) PURE;
+ STDMETHOD_(char*,GetCachedSetting)(const char *szModuleName, const char *szSettingName, int, int) PURE;
+ STDMETHOD_(void,SetCachedVariant)(DBVARIANT *s, DBVARIANT *d) PURE;
+ STDMETHOD_(DBVARIANT*,GetCachedValuePtr)(HANDLE hContact, char *szSetting, int bAllocate) PURE;
+};
+
interface MIDatabase
{
+ MIDatabaseCache* m_cache;
+
STDMETHOD_(void,SetCacheSafetyMode)(BOOL) PURE;
STDMETHOD_(LONG,GetContactCount)(void) PURE;
@@ -194,4 +229,26 @@ __forceinline MIDatabase* GetCurrentDatabase(void)
{ return (MIDatabase*)CallService(MS_DB_GET_CURRENT, 0, 0);
}
+// MS_DB_INIT_INSTANCE : initializes a database instance
+// wParam : 0 (unused)
+// lParam : MIDatabase* = pointer to a database instance
+// returns 0
+
+#define MS_DB_INIT_INSTANCE "DB/InitDbInstance"
+
+__forceinline void InitDbInstance(MIDatabase* pDatabase)
+{ CallService(MS_DB_INIT_INSTANCE, 0, (LPARAM)pDatabase);
+}
+
+// MS_DB_DESTROY_INSTANCE : destroys a database instance
+// wParam : 0 (unused)
+// lParam : MIDatabase* = pointer to a database instance
+// returns 0
+
+#define MS_DB_DESTROY_INSTANCE "DB/DestroyDbInstance"
+
+__forceinline void DestroyDbInstance(MIDatabase* pDatabase)
+{ CallService(MS_DB_DESTROY_INSTANCE, 0, (LPARAM)pDatabase);
+}
+
#endif // M_DB_INT_H__