|
@@ -52,6 +52,11 @@
|
|
#include "db_row.h"
|
|
#include "db_row.h"
|
|
|
|
|
|
|
|
|
|
|
|
+typedef enum {
|
|
|
|
+ DB_POOLING_PERMITTED,
|
|
|
|
+ DB_POOLING_NONE
|
|
|
|
+} db_pooling_t;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* \brief Specify table name that will be used for subsequent operations.
|
|
* \brief Specify table name that will be used for subsequent operations.
|
|
*
|
|
*
|
|
@@ -89,7 +94,7 @@ typedef int (*db_use_table_f)(db1_con_t* _h, const str * _t);
|
|
typedef db1_con_t* (*db_init_f) (const str* _sqlurl);
|
|
typedef db1_con_t* (*db_init_f) (const str* _sqlurl);
|
|
|
|
|
|
/**
|
|
/**
|
|
- * \brief Initialize database connection and obtain a non-pooled connection handle.
|
|
|
|
|
|
+ * \brief Initialize database connection and obtain the connection handle.
|
|
*
|
|
*
|
|
* This function initialize the database API and open a new database
|
|
* This function initialize the database API and open a new database
|
|
* connection. This function must be called after bind_dbmod but before any
|
|
* connection. This function must be called after bind_dbmod but before any
|
|
@@ -107,10 +112,11 @@ typedef db1_con_t* (*db_init_f) (const str* _sqlurl);
|
|
* name of the database (optional).
|
|
* name of the database (optional).
|
|
* \see bind_dbmod
|
|
* \see bind_dbmod
|
|
* \param _sqlurl database connection URL
|
|
* \param _sqlurl database connection URL
|
|
|
|
+ * \param _pooling whether or not to use a pooled connection
|
|
* \return returns a pointer to the db1_con_t representing the connection if it was
|
|
* \return returns a pointer to the db1_con_t representing the connection if it was
|
|
* successful, otherwise 0 is returned
|
|
* successful, otherwise 0 is returned
|
|
*/
|
|
*/
|
|
-typedef db1_con_t* (*db_init_nopool_f) (const str* _sqlurl);
|
|
|
|
|
|
+typedef db1_con_t* (*db_init2_f) (const str* _sqlurl, db_pooling_t _pooling);
|
|
|
|
|
|
/**
|
|
/**
|
|
* \brief Close a database connection and free all memory used.
|
|
* \brief Close a database connection and free all memory used.
|
|
@@ -347,7 +353,7 @@ typedef struct db_func {
|
|
unsigned int cap; /* Capability vector of the database transport */
|
|
unsigned int cap; /* Capability vector of the database transport */
|
|
db_use_table_f use_table; /* Specify table name */
|
|
db_use_table_f use_table; /* Specify table name */
|
|
db_init_f init; /* Initialize database connection */
|
|
db_init_f init; /* Initialize database connection */
|
|
- db_init_nopool_f init_nopool; /* Initialize database connection - no pooling */
|
|
|
|
|
|
+ db_init2_f init2; /* Initialize database connection */
|
|
db_close_f close; /* Close database connection */
|
|
db_close_f close; /* Close database connection */
|
|
db_query_f query; /* query a table */
|
|
db_query_f query; /* query a table */
|
|
db_fetch_result_f fetch_result; /* fetch result */
|
|
db_fetch_result_f fetch_result; /* fetch result */
|
|
@@ -396,7 +402,21 @@ int db_bind_mod(const str* mod, db_func_t* dbf);
|
|
* \return returns a pointer to the db1_con_t representing the connection if it was
|
|
* \return returns a pointer to the db1_con_t representing the connection if it was
|
|
successful, otherwise 0 is returned.
|
|
successful, otherwise 0 is returned.
|
|
*/
|
|
*/
|
|
-db1_con_t* db_do_init(const str* url, void* (*new_connection)(), int nopool);
|
|
|
|
|
|
+db1_con_t* db_do_init(const str* url, void* (*new_connection)());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * \brief Helper for db_init2 function.
|
|
|
|
+ *
|
|
|
|
+ * This helper method do the actual work for the database specific db_init
|
|
|
|
+ * functions.
|
|
|
|
+ * \param url database connection URL
|
|
|
|
+ * \param (*new_connection)() Pointer to the db specific connection creation method
|
|
|
|
+ * \param pooling whether or not to use a pooled connection
|
|
|
|
+ * \return returns a pointer to the db1_con_t representing the connection if it was
|
|
|
|
+ successful, otherwise 0 is returned.
|
|
|
|
+ */
|
|
|
|
+db1_con_t* db_do_init2(const str* url, void* (*new_connection)(), db_pooling_t pooling);
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|