[SR-Dev] git:janakj/mysql: - mysql module exports db_bind_api()
Jan Janak
jan at iptel.org
Mon Feb 16 22:07:52 CET 2009
Module: sip-router
Branch: janakj/mysql
Commit: f5ccb8c5e5a53a3ceafd1bd9f74594c524b7da67
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f5ccb8c5e5a53a3ceafd1bd9f74594c524b7da67
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Fri Feb 29 20:38:56 2008 +0000
- mysql module exports db_bind_api()
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3813 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_db_mysql.c | 41 +++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/modules/db_mysql/km_db_mysql.c b/modules/db_mysql/km_db_mysql.c
index 48ce629..b25587f 100644
--- a/modules/db_mysql/km_db_mysql.c
+++ b/modules/db_mysql/km_db_mysql.c
@@ -30,6 +30,7 @@
*/
#include "../../sr_module.h"
+#include "../../db/db.h"
#include "dbase.h"
#include "db_mysql.h"
@@ -43,24 +44,13 @@ static int mysql_mod_init(void);
MODULE_VERSION
+int db_mysql_bind_api(db_func_t *dbb);
/*
* MySQL database module interface
*/
static cmd_export_t cmds[] = {
- {"db_use_table", (cmd_function)db_mysql_use_table, 2, 0, 0, 0},
- {"db_init", (cmd_function)db_mysql_init, 1, 0, 0, 0},
- {"db_close", (cmd_function)db_mysql_close, 2, 0, 0, 0},
- {"db_query", (cmd_function)db_mysql_query, 2, 0, 0, 0},
- {"db_fetch_result", (cmd_function)db_mysql_fetch_result, 2, 0, 0, 0},
- {"db_raw_query", (cmd_function)db_mysql_raw_query, 2, 0, 0, 0},
- {"db_free_result", (cmd_function)db_mysql_free_result, 2, 0, 0, 0},
- {"db_insert", (cmd_function)db_mysql_insert, 2, 0, 0, 0},
- {"db_delete", (cmd_function)db_mysql_delete, 2, 0, 0, 0},
- {"db_update", (cmd_function)db_mysql_update, 2, 0, 0, 0},
- {"db_replace", (cmd_function)db_mysql_replace, 2, 0, 0, 0},
- {"db_last_inserted_id", (cmd_function)db_last_inserted_id, 1, 0, 0, 0},
- {"db_insert_update", (cmd_function)db_insert_update, 2, 0, 0, 0},
+ {"db_bind_api", (cmd_function)db_mysql_bind_api, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
@@ -97,3 +87,28 @@ static int mysql_mod_init(void)
LM_DBG("mysql: MySQL client version is %s\n", mysql_get_client_info());
return 0;
}
+
+int db_mysql_bind_api(db_func_t *dbb)
+{
+ if(dbb==NULL)
+ return -1;
+
+ memset(dbb, 0, sizeof(db_func_t));
+
+ dbb->use_table = db_mysql_use_table;
+ dbb->init = db_mysql_init;
+ dbb->close = db_mysql_close;
+ dbb->query = db_mysql_query;
+ dbb->fetch_result = db_mysql_fetch_result;
+ dbb->raw_query = db_mysql_raw_query;
+ dbb->free_result = db_mysql_free_result;
+ dbb->insert = db_mysql_insert;
+ dbb->delete = db_mysql_delete;
+ dbb->update = db_mysql_update;
+ dbb->replace = db_mysql_replace;
+ dbb->last_inserted_id = db_last_inserted_id;
+ dbb->insert_update = db_insert_update;
+
+ return 0;
+}
+
More information about the sr-dev
mailing list