Module: sip-router
Branch: janakj/bdb
Commit: 6a6d498f4437d0717af063aaa1ec8d29d6919a22
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6a6d498…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Mar 4 16:12:41 2008 +0000
- DB API export updated to be done via db_bind_api()
git-svn-id:
https://openser.svn.sourceforge.net/svnroot/openser/trunk@3844
689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/km_db_berkeley.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/modules/db_berkeley/km_db_berkeley.c b/modules/db_berkeley/km_db_berkeley.c
index c0483ca..b829ddb 100644
--- a/modules/db_berkeley/km_db_berkeley.c
+++ b/modules/db_berkeley/km_db_berkeley.c
@@ -38,6 +38,7 @@
#include "../../sr_module.h"
#include "../../db/db_res.h"
+#include "../../db/db.h"
#include "db_berkeley.h"
#include "bdb_lib.h"
#include "bdb_res.h"
@@ -63,18 +64,13 @@ int journal_roll_interval = 0;
static int mod_init(void);
static void destroy(void);
+int bdb_bind_api(db_func_t *dbb);
+
/*
* Exported functions
*/
static cmd_export_t cmds[] = {
- {"db_use_table", (cmd_function)bdb_use_table, 2, 0, 0, 0},
- {"db_init", (cmd_function)bdb_init, 1, 0, 0, 0},
- {"db_close", (cmd_function)bdb_close, 2, 0, 0, 0},
- {"db_query", (cmd_function)bdb_query, 2, 0, 0, 0},
- {"db_free_result", (cmd_function)bdb_free_query, 2, 0, 0, 0},
- {"db_insert", (cmd_function)bdb_insert, 2, 0, 0, 0},
- {"db_delete", (cmd_function)bdb_delete, 2, 0, 0, 0},
- {"db_update", (cmd_function)bdb_update, 2, 0, 0, 0},
+ {"db_bind_api", (cmd_function)bdb_bind_api, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
@@ -133,6 +129,25 @@ static void destroy(void)
bdblib_destroy();
}
+int dbt_bind_api(db_func_t *dbb)
+{
+ if(dbb==NULL)
+ return -1;
+
+ memset(dbb, 0, sizeof(db_func_t));
+
+ dbb->use_table = bdb_use_table;
+ dbb->init = bdb_init;
+ dbb->close = bdb_close;
+ dbb->query = (db_query_f)bdb_query;
+ dbb->free_result = bdb_free_query;
+ dbb->insert = (db_insert_f)bdb_insert;
+ dbb->delete = (db_delete_f)bdb_delete;
+ dbb->update = (db_update_f)bdb_update;
+
+ return 0;
+}
+
int bdb_use_table(db_con_t* _h, const str* _t)
{
return db_use_table(_h, _t);