Browse Source

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
Daniel-Constantin Mierla 14 years ago
parent
commit
86e28b0747
2 changed files with 25 additions and 0 deletions
  1. 15 0
      lib/srdb1/db.c
  2. 10 0
      lib/srdb1/db.h

+ 15 - 0
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;
+}

+ 10 - 0
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 */