Module: sip-router
Branch: master
Commit: 86e28b07474e75582423f50f560cf6156022da86
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=86e28b0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Nov 1 20:15:50 2011 +0100
srdb1: added db_api_init() function
- to be executed to initialize internas of DB API library
- calls internal function db_query_init() that initialize the buffer to
print db queries
---
lib/srdb1/db.c | 15 +++++++++++++++
lib/srdb1/db.h | 10 ++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/lib/srdb1/db.c b/lib/srdb1/db.c
index b8abefa..892a849 100644
--- a/lib/srdb1/db.c
+++ b/lib/srdb1/db.c
@@ -64,6 +64,7 @@
#include "db_cap.h"
#include "db_id.h"
#include "db_pool.h"
+#include "db_query.h"
#include "db.h"
static unsigned int MAX_URL_LENGTH = 255; /*!< maximum length of a SQL URL */
@@ -490,3 +491,17 @@ int db_load_bulk_data(db_func_t* binding, db1_con_t* handle, str* name, db_key_t
return 0;
}
+
+/**
+ * \brief DB API init function.
+ *
+ * This function must be executed by DB connector modules at load time to
+ * initialize the internals of DB API library.
+ * \return returns 0 on successful initialization, -1 on error.
+ */
+int db_api_init(void)
+{
+ if(db_query_init()<0)
+ return -1;
+ return 0;
+}
diff --git a/lib/srdb1/db.h b/lib/srdb1/db.h
index 294488c..64969a8 100644
--- a/lib/srdb1/db.h
+++ b/lib/srdb1/db.h
@@ -443,4 +443,14 @@ typedef int (*db_bind_api_f)(db_func_t *dbb);
int db_load_bulk_data(db_func_t* binding, db1_con_t* handle, str* name, db_key_t* cols,
unsigned int count, unsigned int strict, db1_res_t* res);
+/**
+ * \brief DB API init function.
+ *
+ * This function must be executed by DB connector modules at load time to
+ * initialize the internals of DB API library.
+ * \return returns 0 on successful initialization, -1 on error.
+ */
+int db_api_init(void);
+
+
#endif /* DB1_H */