Browse Source

Renamed db_res_t to db1_res_t to avoid conflicts with libsrdb2.

Jan Janak 16 years ago
parent
commit
13f9c1e6fe
8 changed files with 33 additions and 33 deletions
  1. 1 1
      lib/srdb1/db.c
  2. 4 4
      lib/srdb1/db.h
  3. 4 4
      lib/srdb1/db_query.c
  4. 4 4
      lib/srdb1/db_query.h
  5. 10 10
      lib/srdb1/db_res.c
  6. 8 8
      lib/srdb1/db_res.h
  7. 1 1
      lib/srdb1/db_row.c
  8. 1 1
      lib/srdb1/db_row.h

+ 1 - 1
lib/srdb1/db.c

@@ -338,7 +338,7 @@ int db_table_version(const db_func_t* dbf, db1_con_t* connection, const str* tab
 {
 {
 	db_key_t key[1], col[1];
 	db_key_t key[1], col[1];
 	db_val_t val[1];
 	db_val_t val[1];
-	db_res_t* res = NULL;
+	db1_res_t* res = NULL;
 	db_val_t* ver = 0;
 	db_val_t* ver = 0;
 
 
 	if (!dbf||!connection || !table || !table->s) {
 	if (!dbf||!connection || !table || !table->s) {

+ 4 - 4
lib/srdb1/db.h

@@ -129,7 +129,7 @@ typedef void (*db_close_f) (db1_con_t* _h);
  */
  */
 typedef int (*db_query_f) (const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 typedef int (*db_query_f) (const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 				const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
 				const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-				const db_key_t _o, db_res_t** _r);
+				const db_key_t _o, db1_res_t** _r);
 
 
 /**
 /**
  * \brief Gets a partial result set, fetch rows from a result
  * \brief Gets a partial result set, fetch rows from a result
@@ -146,7 +146,7 @@ typedef int (*db_query_f) (const db1_con_t* _h, const db_key_t* _k, const db_op_
  * \param _n the number of rows that should be fetched
  * \param _n the number of rows that should be fetched
  * \return returns 0 if everything is OK, otherwise returns value < 0
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
  */
-typedef int (*db_fetch_result_f) (const db1_con_t* _h, db_res_t** _r, const int _n);
+typedef int (*db_fetch_result_f) (const db1_con_t* _h, db1_res_t** _r, const int _n);
 
 
 
 
 /**
 /**
@@ -164,7 +164,7 @@ typedef int (*db_fetch_result_f) (const db1_con_t* _h, db_res_t** _r, const int
  * \param _r structure for the result
  * \param _r structure for the result
  * \return returns 0 if everything is OK, otherwise returns value < 0
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
  */
-typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db_res_t** _r);
+typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db1_res_t** _r);
 
 
 
 
 /**
 /**
@@ -177,7 +177,7 @@ typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db_res_t** _r
  * \param _r pointer to db_res_t structure to destroy
  * \param _r pointer to db_res_t structure to destroy
  * \return returns 0 if everything is OK, otherwise returns value < 0
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
  */
-typedef int (*db_free_result_f) (db1_con_t* _h, db_res_t* _r);
+typedef int (*db_free_result_f) (db1_con_t* _h, db1_res_t* _r);
 
 
 
 
 /**
 /**

+ 4 - 4
lib/srdb1/db_query.c

@@ -42,9 +42,9 @@ static char sql_buf[SQL_BUF_LEN];
 
 
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-	const db_key_t _o, db_res_t** _r, int (*val2str) (const db1_con_t*,
+	const db_key_t _o, db1_res_t** _r, int (*val2str) (const db1_con_t*,
 	const db_val_t*, char*, int* _len), int (*submit_query)(const db1_con_t*,
 	const db_val_t*, char*, int* _len), int (*submit_query)(const db1_con_t*,
-	const str*), int (*store_result)(const db1_con_t* _h, db_res_t** _r))
+	const str*), int (*store_result)(const db1_con_t* _h, db1_res_t** _r))
 {
 {
 	int off, ret;
 	int off, ret;
 
 
@@ -117,9 +117,9 @@ error:
 }
 }
 
 
 
 
-int db_do_raw_query(const db1_con_t* _h, const str* _s, db_res_t** _r,
+int db_do_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r,
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
-	int (*store_result)(const db1_con_t* _h, db_res_t** _r))
+	int (*store_result)(const db1_con_t* _h, db1_res_t** _r))
 {
 {
 	if (!_h || !_s || !submit_query || !store_result) {
 	if (!_h || !_s || !submit_query || !store_result) {
 		LM_ERR("invalid parameter value\n");
 		LM_ERR("invalid parameter value\n");

+ 4 - 4
lib/srdb1/db_query.h

@@ -68,9 +68,9 @@
  */
  */
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-	const db_key_t _o, db_res_t** _r, int (*val2str) (const db1_con_t*,
+	const db_key_t _o, db1_res_t** _r, int (*val2str) (const db1_con_t*,
 	const db_val_t*, char*, int*), int (*submit_query)(const db1_con_t* _h,
 	const db_val_t*, char*, int*), int (*submit_query)(const db1_con_t* _h,
-	const str* _c), int (*store_result)(const db1_con_t* _h, db_res_t** _r));
+	const str* _c), int (*store_result)(const db1_con_t* _h, db1_res_t** _r));
 
 
 
 
 /**
 /**
@@ -88,9 +88,9 @@ int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
  * \param (*store_result) function pointer to the db specific store result function
  * \param (*store_result) function pointer to the db specific store result function
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-int db_do_raw_query(const db1_con_t* _h, const str* _s, db_res_t** _r,
+int db_do_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r,
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
-	int (*store_result)(const db1_con_t* _h, db_res_t** _r));
+	int (*store_result)(const db1_con_t* _h, db1_res_t** _r));
 
 
 
 
 /**
 /**

+ 10 - 10
lib/srdb1/db_res.c

@@ -41,7 +41,7 @@
 /*
 /*
  * Release memory used by rows
  * Release memory used by rows
  */
  */
-inline int db_free_rows(db_res_t* _r)
+inline int db_free_rows(db1_res_t* _r)
 {
 {
 	int i;
 	int i;
 
 
@@ -68,7 +68,7 @@ inline int db_free_rows(db_res_t* _r)
 /*
 /*
  * Release memory used by columns
  * Release memory used by columns
  */
  */
-inline int db_free_columns(db_res_t* _r)
+inline int db_free_columns(db1_res_t* _r)
 {
 {
 	int col;
 	int col;
 
 
@@ -104,24 +104,24 @@ inline int db_free_columns(db_res_t* _r)
 /*
 /*
  * Create a new result structure and initialize it
  * Create a new result structure and initialize it
  */
  */
-inline db_res_t* db_new_result(void)
+inline db1_res_t* db_new_result(void)
 {
 {
-	db_res_t* r = NULL;
-	r = (db_res_t*)pkg_malloc(sizeof(db_res_t));
+	db1_res_t* r = NULL;
+	r = (db1_res_t*)pkg_malloc(sizeof(db1_res_t));
 	if (!r) {
 	if (!r) {
 		LM_ERR("no private memory left\n");
 		LM_ERR("no private memory left\n");
 		return 0;
 		return 0;
 	}
 	}
 	LM_DBG("allocate %d bytes for result set at %p\n",
 	LM_DBG("allocate %d bytes for result set at %p\n",
-		(int)sizeof(db_res_t), r);
-	memset(r, 0, sizeof(db_res_t));
+		(int)sizeof(db1_res_t), r);
+	memset(r, 0, sizeof(db1_res_t));
 	return r;
 	return r;
 }
 }
 
 
 /*
 /*
  * Release memory used by a result structure
  * Release memory used by a result structure
  */
  */
-inline int db_free_result(db_res_t* _r)
+inline int db_free_result(db1_res_t* _r)
 {
 {
 	if (!_r)
 	if (!_r)
 	{
 	{
@@ -141,7 +141,7 @@ inline int db_free_result(db_res_t* _r)
  * Allocate storage for column names and type in existing
  * Allocate storage for column names and type in existing
  * result structure.
  * result structure.
  */
  */
-inline int db_allocate_columns(db_res_t* _r, const unsigned int cols)
+inline int db_allocate_columns(db1_res_t* _r, const unsigned int cols)
 {
 {
 	RES_NAMES(_r) = (db_key_t*)pkg_malloc(sizeof(db_key_t) * cols);
 	RES_NAMES(_r) = (db_key_t*)pkg_malloc(sizeof(db_key_t) * cols);
 	if (!RES_NAMES(_r)) {
 	if (!RES_NAMES(_r)) {
@@ -171,7 +171,7 @@ inline int db_allocate_columns(db_res_t* _r, const unsigned int cols)
  * \param _res result set
  * \param _res result set
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_allocate_rows(db_res_t* _res)
+inline int db_allocate_rows(db1_res_t* _res)
 {
 {
 	int len = sizeof(db_row_t) * RES_ROW_N(_res);
 	int len = sizeof(db_row_t) * RES_ROW_N(_res);
 	RES_ROWS(_res) = (struct db_row*)pkg_malloc(len);
 	RES_ROWS(_res) = (struct db_row*)pkg_malloc(len);

+ 8 - 8
lib/srdb1/db_res.h

@@ -51,7 +51,7 @@ struct db_row;
  * In addition to zero or more rows, each db_res_t object contains also an array
  * In addition to zero or more rows, each db_res_t object contains also an array
  * of db_key_t objects. The objects represent keys (names of columns). *
  * of db_key_t objects. The objects represent keys (names of columns). *
  */
  */
-typedef struct db_res {
+typedef struct db1_res {
 	struct {
 	struct {
 		db_key_t* names;   /**< Column names                    */
 		db_key_t* names;   /**< Column names                    */
 		db_type_t* types;  /**< Column types                    */
 		db_type_t* types;  /**< Column types                    */
@@ -61,7 +61,7 @@ typedef struct db_res {
 	int n;                 /**< Number of rows in current fetch */
 	int n;                 /**< Number of rows in current fetch */
 	int res_rows;          /**< Number of total rows in query   */
 	int res_rows;          /**< Number of total rows in query   */
 	int last_row;          /**< Last row                        */
 	int last_row;          /**< Last row                        */
-} db_res_t;
+} db1_res_t;
 
 
 
 
 /** Return the column names */
 /** Return the column names */
@@ -85,7 +85,7 @@ typedef struct db_res {
  * \param _r the result that should be released
  * \param _r the result that should be released
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_free_rows(db_res_t* _r);
+inline int db_free_rows(db1_res_t* _r);
 
 
 
 
 /**
 /**
@@ -95,20 +95,20 @@ inline int db_free_rows(db_res_t* _r);
  * \param _r the result that should be released
  * \param _r the result that should be released
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_free_columns(db_res_t* _r);
+inline int db_free_columns(db1_res_t* _r);
 
 
 
 
 /**
 /**
  * Create a new result structure and initialize it.
  * Create a new result structure and initialize it.
  * \return a pointer to the new result on success, NULL on errors
  * \return a pointer to the new result on success, NULL on errors
  */
  */
-inline db_res_t* db_new_result(void);
+inline db1_res_t* db_new_result(void);
 
 
 /**
 /**
  * Release memory used by a result structure.
  * Release memory used by a result structure.
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_free_result(db_res_t* _r);
+inline int db_free_result(db1_res_t* _r);
 
 
 /**
 /**
  * Allocate storage for column names and type in existing result structure.
  * Allocate storage for column names and type in existing result structure.
@@ -118,7 +118,7 @@ inline int db_free_result(db_res_t* _r);
  * \param cols number of columns
  * \param cols number of columns
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_allocate_columns(db_res_t* _r, const unsigned int cols);
+inline int db_allocate_columns(db1_res_t* _r, const unsigned int cols);
 
 
 
 
 /**
 /**
@@ -126,6 +126,6 @@ inline int db_allocate_columns(db_res_t* _r, const unsigned int cols);
  * \param _res result set
  * \param _res result set
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_allocate_rows(db_res_t* _res);
+inline int db_allocate_rows(db1_res_t* _res);
 
 
 #endif /* DB_RES_H */
 #endif /* DB_RES_H */

+ 1 - 1
lib/srdb1/db_row.c

@@ -108,7 +108,7 @@ inline int db_free_row(db_row_t* _r)
  * \param _row filled row
  * \param _row filled row
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_allocate_row(const db_res_t* _res, db_row_t* _row)
+inline int db_allocate_row(const db1_res_t* _res, db_row_t* _row)
 {
 {
 	int len = sizeof(db_val_t) * RES_COL_N(_res);
 	int len = sizeof(db_val_t) * RES_COL_N(_res);
 	ROW_VALUES(_row) = (db_val_t*)pkg_malloc(len);
 	ROW_VALUES(_row) = (db_val_t*)pkg_malloc(len);

+ 1 - 1
lib/srdb1/db_row.h

@@ -71,6 +71,6 @@ inline int db_free_row(db_row_t* _r);
  * \param _row filled row
  * \param _row filled row
  * \return zero on success, negative on errors
  * \return zero on success, negative on errors
  */
  */
-inline int db_allocate_row(const db_res_t* _res, db_row_t* _row);
+inline int db_allocate_row(const db1_res_t* _res, db_row_t* _row);
 
 
 #endif /* DB_ROW_H */
 #endif /* DB_ROW_H */