瀏覽代碼

db_mysql: insert delayed implemented for DB API v1

Daniel-Constantin Mierla 14 年之前
父節點
當前提交
4c7c1b8196
共有 3 個文件被更改,包括 24 次插入1 次删除
  1. 1 0
      modules/db_mysql/km_db_mysql.c
  2. 16 1
      modules/db_mysql/km_dbase.c
  3. 7 0
      modules/db_mysql/km_dbase.h

+ 1 - 0
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->replace          = db_mysql_replace;
 	dbb->last_inserted_id = db_last_inserted_id;
 	dbb->last_inserted_id = db_last_inserted_id;
 	dbb->insert_update    = db_insert_update;
 	dbb->insert_update    = db_insert_update;
+	dbb->insert_delayed   = db_mysql_insert_delayed;
 
 
 	return 0;
 	return 0;
 }
 }

+ 16 - 1
modules/db_mysql/km_dbase.c

@@ -538,6 +538,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
  * Store the name of table that will be used by subsequent database functions
  * \param _h database handle
  * \param _h database handle
@@ -568,4 +583,4 @@ int db_mysql_alloc_buffer(void)
         return -1;
         return -1;
     else
     else
         return 0;
         return 0;
-}
+}

+ 7 - 0
modules/db_mysql/km_dbase.h

@@ -118,6 +118,13 @@ int db_insert_update(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v
 	const int _n);
 	const int _n);
 
 
 
 
+/*! \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
 /*! \brief
  * Store name of table that will be used by
  * Store name of table that will be used by
  * subsequent database functions
  * subsequent database functions