From a546606709e6bb72e01eb38b2c8c8756608fd5d6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Jun 2013 10:50:46 +0000 Subject: forgotten helper - db_set (writes a DBVARIANT) git-svn-id: http://svn.miranda-ng.org/main/trunk@5190 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 37186 -> 37366 bytes bin10/lib/mir_core64.lib | Bin 33934 -> 34090 bytes bin11/lib/mir_core.lib | Bin 37186 -> 37366 bytes bin11/lib/mir_core64.lib | Bin 33934 -> 34090 bytes include/delphi/m_core.inc | 6 ++++-- include/m_core.h | 3 ++- src/mir_core/db.cpp | 11 +++++++++++ src/mir_core/mir_core.def | 1 + 8 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index 613db9ff55..6b27834f54 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index 7d7061392f..1f0ef023be 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib index 5cdf3a6d0e..cd69121b36 100644 Binary files a/bin11/lib/mir_core.lib and b/bin11/lib/mir_core.lib differ diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib index f8fe2f5e2e..33bd0bb49c 100644 Binary files a/bin11/lib/mir_core64.lib and b/bin11/lib/mir_core64.lib differ diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 82acc44c5a..921f3e64b2 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -136,14 +136,14 @@ function db_find_first(const szModule:pAnsiChar=nil):THANDLE; stdcall; function db_find_next(hContact:THANDLE; const szModule:pAnsiChar=nil):THANDLE; stdcall; external CoreDLL name 'db_find_next'; +function db_get(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_get'; function db_get_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_b'; function db_get_w(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_w'; function db_get_dw(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:dword):dword; stdcall; external CoreDLL name 'db_get_dw'; -function db_get(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_get'; function db_get_s(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; external CoreDLL name 'db_get_s'; function db_get_sa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pAnsiChar; stdcall; @@ -151,6 +151,8 @@ function db_get_sa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:p function db_get_wsa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; external CoreDLL name 'db_get_wsa'; +function db_set(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_set'; function db_set_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; external CoreDLL name 'db_set_b'; function db_set_w(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:word):int_ptr; stdcall; diff --git a/include/m_core.h b/include/m_core.h index 638666c0d7..f4cb21587d 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -283,10 +283,10 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent); * DATABASE SETTINGS */ +MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue); MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue); MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue); -MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const char *szSetting); MIR_CORE_DLL(WCHAR*) db_get_wsa(HANDLE hContact, const char *szModule, const char *szSetting); @@ -296,6 +296,7 @@ MIR_CORE_DLL(WCHAR*) db_get_wsa(HANDLE hContact, const char *szModule, const ch MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType); #endif +MIR_CORE_DLL(INT_PTR) db_set(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val); MIR_CORE_DLL(INT_PTR) db_set_w(HANDLE hContact, const char *szModule, const char *szSetting, WORD val); MIR_CORE_DLL(INT_PTR) db_set_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD val); diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 08703f6581..f665899073 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -131,6 +131,17 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const c ///////////////////////////////////////////////////////////////////////////////////////// // setting data +MIR_CORE_DLL(INT_PTR) db_set(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +{ + if (currDb == NULL) return 1; + + DBCONTACTWRITESETTING cws; + cws.szModule = szModule; + cws.szSetting = szSetting; + cws.value = *dbv; + return currDb->WriteContactSetting(hContact, &cws); +} + MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val) { if (currDb == NULL) return 1; diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index d72f8e0087..1b3fbd6df1 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -165,3 +165,4 @@ ProtoServiceExists @162 ProtoBroadcastAck @163 ProtoCallService @164 db_set_resident @165 +db_set @166 -- cgit v1.2.3