From 2df45c323dff08d54e21f9a99610cb69d2d01075 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 10 Oct 2012 07:00:35 +0000 Subject: two new db stubs: db_find_first & db_find_next git-svn-id: http://svn.miranda-ng.org/main/trunk@1855 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/db.cpp | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'src/mir_core/db.cpp') diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index f9a1ba1118..e70701764a 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static MIDatabase* currDb = NULL; +///////////////////////////////////////////////////////////////////////////////////////// +// getting data + MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { if (currDb != NULL) { @@ -76,7 +79,7 @@ MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char case DBVT_DWORD: return dbv.dVal; } } - + return errorValue; } @@ -125,22 +128,8 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const c return str; } -MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv) -{ - if (currDb == NULL) return 1; - - return currDb->FreeVariant(dbv); -} - -MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting) -{ - if (currDb == NULL) return 1; - - DBCONTACTGETSETTING cgs; - cgs.szModule = szModule; - cgs.szSetting = szSetting; - return currDb->DeleteContactSetting(hContact, &cgs); -} +///////////////////////////////////////////////////////////////////////////////////////// +// setting data MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val) { @@ -227,6 +216,34 @@ MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const c return currDb->WriteContactSetting(hContact, &cws); } +///////////////////////////////////////////////////////////////////////////////////////// +// misc functions + +MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv) +{ + return (currDb == NULL) ? 1 : currDb->FreeVariant(dbv); +} + +MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting) +{ + if (currDb == NULL) return 1; + + DBCONTACTGETSETTING cgs; + cgs.szModule = szModule; + cgs.szSetting = szSetting; + return currDb->DeleteContactSetting(hContact, &cgs); +} + +MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto) +{ + return (currDb == NULL) ? NULL : currDb->FindFirstContact(szProto); +} + +MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto) +{ + return (currDb == NULL) ? NULL : currDb->FindNextContact(hContact, szProto); +} + extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db) { currDb = _db; -- cgit v1.2.3