Browse code

free_query changed to free_result

Jan Janak authored on 04/08/2004 14:26:24
Showing 7 changed files
... ...
@@ -91,9 +91,9 @@ int bind_dbmod(char* mod, db_func_t* mydbf)
91 91
 	dbf.raw_query = (db_raw_query_f)find_mod_export(tmp, "db_raw_query", 2, 0);
92 92
 	if (dbf.raw_query == 0) goto err;
93 93
 
94
-	dbf.free_query = (db_free_query_f)find_mod_export(tmp, "db_free_query", 2,
94
+	dbf.free_result = (db_free_result_f)find_mod_export(tmp, "db_free_result", 2,
95 95
 														0);
96
-	if (dbf.free_query == 0) goto err;
96
+	if (dbf.free_result == 0) goto err;
97 97
 
98 98
 	dbf.insert = (db_insert_f)find_mod_export(tmp, "db_insert", 2, 0);
99 99
 	if (dbf.insert == 0) goto err;
... ...
@@ -154,11 +154,11 @@ int table_version(db_func_t* dbf, db_con_t* connection, const str* table)
154 154
 
155 155
 	if (RES_ROW_N(res) != 1) {
156 156
 		LOG(L_ERR, "table_version(): Invalid number of rows received: %d, %.*s\n", RES_ROW_N(res), table->len, ZSW(table->s));
157
-		dbf->free_query(connection, res);
157
+		dbf->free_result(connection, res);
158 158
 		return -1;
159 159
 	}
160 160
 
161 161
 	ret = VAL_INT(ROW_VALUES(RES_ROWS(res)));
162
-	dbf->free_query(connection, res);
162
+	dbf->free_result(connection, res);
163 163
 	return ret;
164 164
 }
... ...
@@ -93,7 +93,7 @@ typedef int (*db_raw_query_f) (db_con_t* _h, char* _s, db_res_t** _r);
93 93
  * _h: structure representing database connection
94 94
  * _r: db_res structure
95 95
  */
96
-typedef int (*db_free_query_f) (db_con_t* _h, db_res_t* _r);
96
+typedef int (*db_free_result_f) (db_con_t* _h, db_res_t* _r);
97 97
 
98 98
 
99 99
 /*
... ...
@@ -134,15 +134,15 @@ typedef int (*db_update_f) (db_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _
134 134
 
135 135
 
136 136
 typedef struct db_func {
137
-	db_use_table_f  use_table;   /* Specify table name */
138
-	db_init_f       init;        /* Initialize dabase connection */
139
-	db_close_f      close;       /* Close database connection */
140
-	db_query_f      query;       /* query a table */
141
-	db_raw_query_f  raw_query;   /* Raw query - SQL */
142
-	db_free_query_f free_query;  /* Free a query result */
143
-	db_insert_f     insert;      /* Insert into table */
144
-	db_delete_f     delete;      /* Delete from table */ 
145
-	db_update_f     update;      /* Update table */
137
+	db_use_table_f   use_table;    /* Specify table name */
138
+	db_init_f        init;         /* Initialize dabase connection */
139
+	db_close_f       close;        /* Close database connection */
140
+	db_query_f       query;        /* query a table */
141
+	db_raw_query_f   raw_query;    /* Raw query - SQL */
142
+	db_free_result_f free_result;  /* Free a query result */
143
+	db_insert_f      insert;       /* Insert into table */
144
+	db_delete_f      delete;       /* Delete from table */ 
145
+	db_update_f      update;       /* Update table */
146 146
 } db_func_t;
147 147
 
148 148
 
... ...
@@ -692,7 +692,7 @@ int db_fifo( FILE *fifo, char *response_file )
692 692
 			/* get all response and write them into reply fifo */
693 693
 			print_res( select_res, rpl);
694 694
 			/* free the query response */
695
-			fifo_dbf.free_query( fifo_db_con, select_res);
695
+			fifo_dbf.free_result( fifo_db_con, select_res);
696 696
 		}
697 697
 		/* done with success */
698 698
 		goto done;
... ...
@@ -730,7 +730,7 @@ int db_fifo( FILE *fifo, char *response_file )
730 730
 			/* get all response and write them into reply fifo */
731 731
 			print_res( select_res, rpl);
732 732
 			/* free the query response */
733
-			fifo_dbf.free_query( fifo_db_con, select_res);
733
+			fifo_dbf.free_result( fifo_db_con, select_res);
734 734
 			break;
735 735
 		case UPDATE_CMD:
736 736
 			if (nr1==0) {
... ...
@@ -252,7 +252,7 @@ This type represents a result returned by db_query function (see below). The
252 252
 result can consist of zero or more rows (see db_row_t description).
253 253
 
254 254
 Note: A variable of type db_res_t returned by db_query function uses dynamicaly
255
-      allocated memory, don't forget to call db_free_query if you don't need 
255
+      allocated memory, don't forget to call db_free_result if you don't need 
256 256
       the variable anymore. You will encounter memory leaks if you fail to do 
257 257
       this !
258 258
 
... ...
@@ -442,21 +442,21 @@ If _k and _v parameters are NULL and _n is zero, you will get the whole table.
442 442
 if _c is NULL and _nc is zero, you will get all table columns in the result
443 443
 
444 444
 _r will point to a dynamically allocated structure, it is neccessary to call
445
-db_free_query function once you are finished with the result.
445
+db_free_result function once you are finished with the result.
446 446
 
447 447
 If _op is 0, equal (=) will be used for all key-value pairs.
448 448
 
449 449
 Strings in the result are not duplicated, they will be discarded if you call
450
-db_free_query, make a copy yourself if you need to keep it after db_free_query.
450
+db_free_result, make a copy yourself if you need to keep it after db_free_result.
451 451
 
452
-You must call db_free_query _BEFORE_ you can call db_query again !
452
+You must call db_free_result _BEFORE_ you can call db_query again !
453 453
 
454 454
 2.4.4 Return Value
455 455
 
456 456
 The function returns 0 if everything is OK, otherwise value < 0 is returned.
457 457
 
458 458
 
459
-2.5 Callback dbf.free_query
459
+2.5 Callback dbf.free_result
460 460
 
461 461
 2.5.1 Description
462 462
 
... ...
@@ -467,7 +467,7 @@ again !
467 467
 
468 468
 2.5.2 Prototype
469 469
 
470
-   int (*db_free_query_f)(db_con_t* _h, db_res_t* _r);
470
+   int (*db_free_result_f)(db_con_t* _h, db_res_t* _r);
471 471
 
472 472
 2.5.3 Parameters
473 473
 
... ...
@@ -263,7 +263,7 @@ struct module_exports* mod_register()
263 263
 	      * Free the result because we don't need it
264 264
 	      * anymore
265 265
 	      */
266
-	if (db_free_query(h, res) < 0) {
266
+	if (db_free_result(h, res) < 0) {
267 267
 		fprintf(stderr, "Error while freeing result of query\n");
268 268
 		return &dbex_exports;
269 269
 	}
... ...
@@ -4492,7 +4492,7 @@ for(i = 0; i < ROW_N(row); i++) {
4492 4492
 		    <para>
4493 4493
 			A variable of type <type>db_res_t</type> returned by <function moreinfo="none">db_query</function>
4494 4494
 			function uses dynamically allocated memory, don't forget to call 
4495
-			<function moreinfo="none">db_free_query</function> if you don't need the variable anymore. 
4495
+			<function moreinfo="none">db_free_result</function> if you don't need the variable anymore. 
4496 4496
 			You will encounter memory leaks if you fail to do this !
4497 4497
 		    </para>
4498 4498
 		</note>
... ...
@@ -4763,14 +4763,14 @@ int n = RES_ROW_N(res);
4763 4763
 		</para>
4764 4764
 		<para>
4765 4765
 		    _r will point to a dynamically allocated structure, it is necessary to call
4766
-		    db_free_query function once you are finished with the result.
4766
+		    db_free_result function once you are finished with the result.
4767 4767
 		</para>
4768 4768
 		<para>
4769 4769
 		    Strings in the result are not duplicated, they will be discarded if you call
4770
-		    db_free_query, make a copy yourself if you need to keep it after db_free_query.
4770
+		    db_free_result, make a copy yourself if you need to keep it after db_free_result.
4771 4771
 		</para>
4772 4772
 		<para>
4773
-		    You must call db_free_query <emphasis>BEFORE</emphasis> you can call db_query again !
4773
+		    You must call db_free_result <emphasis>BEFORE</emphasis> you can call db_query again !
4774 4774
 		</para>
4775 4775
 		<para>
4776 4776
 		    The function returns 0 if everything is OK, otherwise value &lt; 0 is returned.
... ...
@@ -4778,7 +4778,7 @@ int n = RES_ROW_N(res);
4778 4778
 	    </section> <!-- db-query -->
4779 4779
 
4780 4780
 	    <section id="db-free-query">
4781
-		<title><function moreinfo="none">db_free_query</function></title>
4781
+		<title><function moreinfo="none">db_free_result</function></title>
4782 4782
 		<para>
4783 4783
 		    This function frees all memory allocated previously in <function moreinfo="none">db_query</function>, 
4784 4784
 		    it is necessary to call this function for a <type>db_res_t</type> structure if you don't need the
... ...
@@ -4787,7 +4787,7 @@ int n = RES_ROW_N(res);
4787 4787
 		</para>
4788 4788
 		<funcsynopsis>
4789 4789
 		    <funcprototype>
4790
-			<funcdef>int <function moreinfo="none">db_free_query</function></funcdef>
4790
+			<funcdef>int <function moreinfo="none">db_free_result</function></funcdef>
4791 4791
 			<paramdef>db_con_t* <parameter moreinfo="none">_h</parameter></paramdef>
4792 4792
 			<paramdef>db_res_t* <parameter moreinfo="none">_r</parameter></paramdef>
4793 4793
 		    </funcprototype>
... ...
@@ -293,7 +293,7 @@ int load_avp( struct sip_msg *msg, int uri_type, char *attr, int use_dom)
293 293
 		DBG("DEBUG:load_avp: no avp found for %.*s@%.*s <%s>\n",
294 294
 			uri.user.len,uri.user.s,(use_dom!=0)*uri.host.len,uri.host.s,
295 295
 			attr?attr:"NULL");
296
-		avp_dbf.free_query( avp_db_con, res);
296
+		avp_dbf.free_result( avp_db_con, res);
297 297
 		/*no avp found*/
298 298
 		return 1;
299 299
 	}
... ...
@@ -336,7 +336,7 @@ int load_avp( struct sip_msg *msg, int uri_type, char *attr, int use_dom)
336 336
 		users_avps = avp;
337 337
 	}
338 338
 
339
-	avp_dbf.free_query( avp_db_con, res);
339
+	avp_dbf.free_result( avp_db_con, res);
340 340
 	return 0;
341 341
 error:
342 342
 	return -1;