summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:00:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:00:35 +0000
commit2df45c323dff08d54e21f9a99610cb69d2d01075 (patch)
tree0acebd86b976b78c660c550cc71f76e5dcf0a57e
parent8d831f9b21feb4b203a8209f7ab70d5c533209a3 (diff)
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
-rw-r--r--bin10/lib/mir_core.libbin29718 -> 30134 bytes
-rw-r--r--bin10/lib/mir_core64.libbin27144 -> 27522 bytes
-rw-r--r--include/delphi/m_core.inc9
-rw-r--r--include/m_core.h3
-rw-r--r--src/mir_core/db.cpp51
-rw-r--r--src/mir_core/mir_core.def3
6 files changed, 46 insertions, 20 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index a9496214cf..9d1e620651 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index c89a23eefe..a70910901d 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index 6424d47ebb..2f9401e63d 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -80,6 +80,11 @@ function db_free(dbv:PDBVARIANT):int_ptr; stdcall;
function db_unset(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall;
external CoreDLL name 'db_unset';
+function db_find_first(const szModule:pAnsiChar=nil):THANDLE; stdcall;
+ external CoreDLL name 'db_find_first';
+function db_find_next(hContact:THANDLE; const szModule:pAnsiChar=nil):THANDLE; stdcall;
+ external CoreDLL name 'db_find_next';
+
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;
@@ -286,9 +291,9 @@ function mir_hash(const key:pointer; len:uint):uint; stdcall;
type
TFSortFunc = function (para1:pointer; para2:pointer):int;cdecl;
{
-// Assumes first 32 bit value of the data is the numeric key
+// Assumes first 32 bit value of the data is the numeric key
// and uses it to perform sort/search operations, this results
-// in much better performance as no compare function calls needed
+// in much better performance as no compare function calls needed
// Incredibly useful for Hash Tables
}
const
diff --git a/include/m_core.h b/include/m_core.h
index e617b0ca98..0deec3269b 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -87,6 +87,9 @@ typedef struct {
MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv);
MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting);
+MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto = NULL);
+MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL);
+
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);
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;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 9e4253fc91..df6cce1144 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -132,4 +132,5 @@ CmdLine_Parse @129
Utf8CheckString @130
GetSubscribersCount @131
NotifyFastHook @132
-
+db_find_first @133
+db_find_next @134