[sr-dev] git:master: db_mysql: insert delayed implemented for DB API v1

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 18 00:39:09 CEST 2011


Module: sip-router
Branch: master
Commit: 4c7c1b819699484f4694d7775b94ad72f98cab28
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4c7c1b819699484f4694d7775b94ad72f98cab28

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Aug 18 00:33:51 2011 +0200

db_mysql: insert delayed implemented for DB API v1

---

 modules/db_mysql/km_db_mysql.c |    1 +
 modules/db_mysql/km_dbase.c    |   17 ++++++++++++++++-
 modules/db_mysql/km_dbase.h    |    7 +++++++
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/modules/db_mysql/km_db_mysql.c b/modules/db_mysql/km_db_mysql.c
index bc2833a..2c1c777 100644
--- a/modules/db_mysql/km_db_mysql.c
+++ b/modules/db_mysql/km_db_mysql.c
@@ -113,6 +113,7 @@ int db_mysql_bind_api(db_func_t *dbb)
 	dbb->replace          = db_mysql_replace;
 	dbb->last_inserted_id = db_last_inserted_id;
 	dbb->insert_update    = db_insert_update;
+	dbb->insert_delayed   = db_mysql_insert_delayed;
 
 	return 0;
 }
diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index a7bae5d..8118d9a 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -539,6 +539,21 @@ error:
 
 
 /**
+ * Insert delayed a row into a specified table.
+ * \param _h structure representing database connection
+ * \param _k key names
+ * \param _v values of the keys
+ * \param _n number of key=value pairs
+ * \return zero on success, negative value on failure
+ */
+int db_mysql_insert_delayed(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v, const int _n)
+{
+	return db_do_insert_delayed(_h, _k, _v, _n, db_mysql_val2str,
+	db_mysql_submit_query);
+}
+
+
+/**
  * Store the name of table that will be used by subsequent database functions
  * \param _h database handle
  * \param _t table name
@@ -568,4 +583,4 @@ int db_mysql_alloc_buffer(void)
         return -1;
     else
         return 0;
-}
\ No newline at end of file
+}
diff --git a/modules/db_mysql/km_dbase.h b/modules/db_mysql/km_dbase.h
index a4e7b26..8d687ea 100644
--- a/modules/db_mysql/km_dbase.h
+++ b/modules/db_mysql/km_dbase.h
@@ -119,6 +119,13 @@ int db_insert_update(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v
 
 
 /*! \brief
+ * Insert a row into table
+ */
+int db_mysql_insert_delayed(const db1_con_t* _h, const db_key_t* _k,
+		const db_val_t* _v, const int _n);
+
+
+/*! \brief
  * Store name of table that will be used by
  * subsequent database functions
  */




More information about the sr-dev mailing list