Browse code

Various db api changes needed after migration to libsrdb1

This patch makes the module compatible with the changes done in the
database library of kamailio/ser when it was converted to shared library
libsrdb1. These changes are mostly needed to avoid conflicts with the
symbols defined in the newer version of the library libsrdb2.

List of changes:
* Rename db_con_t to db1_con_t
* Rename db_res_t to db1_res_t
* Rename db field type names from DB_* to DB1_*
* Updated header paths to files in ../../lib/srdb1
* Link with libsrdb1

Jan Janak authored on 03/03/2009 14:41:27
Showing 5 changed files
... ...
@@ -11,4 +11,5 @@ DEFS+=-DOPENSER_MOD_INTERFACE
11 11
 
12 12
 SERLIBPATH=../../lib
13 13
 SER_LIBS+=$(SERLIBPATH)/kmi/kmi
14
+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
14 15
 include ../../Makefile.modules
... ...
@@ -43,7 +43,7 @@
43 43
 #include <sys/time.h>
44 44
 
45 45
 #include "../../sr_module.h"
46
-#include "../../db/db.h"
46
+#include "../../lib/srdb1/db.h"
47 47
 #include "../../dprint.h"
48 48
 #include "../../error.h"
49 49
 #include "../../ut.h"
... ...
@@ -33,7 +33,7 @@
33 33
 #include "../../dprint.h"
34 34
 #include "../../ut.h"
35 35
 #include "../../timer.h"
36
-#include "../../db/db.h"
36
+#include "../../lib/srdb1/db.h"
37 37
 #include "../../str.h"
38 38
 #include "../../socket_info.h"
39 39
 #include "dlg_hash.h"
... ...
@@ -63,7 +63,7 @@ str toroute_column			=	str_init(TOROUTE_COL);
63 63
 str dialog_table_name		=	str_init(DIALOG_TABLE_NAME);
64 64
 int dlg_db_mode				=	DB_MODE_NONE;
65 65
 
66
-static db_con_t* dialog_db_handle    = 0; /* database connection handle */
66
+static db1_con_t* dialog_db_handle    = 0; /* database connection handle */
67 67
 static db_func_t dialog_dbf;
68 68
 
69 69
 extern int dlg_enable_stats;
... ...
@@ -187,7 +187,7 @@ static int use_dialog_table(void)
187 187
 
188 188
 
189 189
 
190
-static int select_entire_dialog_table(db_res_t ** res, int fetch_num_rows)
190
+static int select_entire_dialog_table(db1_res_t ** res, int fetch_num_rows)
191 191
 {
192 192
 	db_key_t query_cols[DIALOG_TABLE_COL_NO] = {	&h_entry_column,
193 193
 			&h_id_column,		&call_id_column,	&from_uri_column,
... ...
@@ -257,7 +257,7 @@ struct socket_info * create_socket_info(db_val_t * vals, int n){
257 257
 
258 258
 static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows)
259 259
 {
260
-	db_res_t * res;
260
+	db1_res_t * res;
261 261
 	db_val_t * values;
262 262
 	db_row_t * rows;
263 263
 	int i, nr_rows;
... ...
@@ -422,7 +422,7 @@ int remove_dialog_from_db(struct dlg_cell * cell)
422 422
 	if (use_dialog_table()!=0)
423 423
 		return -1;
424 424
 
425
-	VAL_TYPE(values) = VAL_TYPE(values+1) = DB_INT;
425
+	VAL_TYPE(values) = VAL_TYPE(values+1) = DB1_INT;
426 426
 	VAL_NULL(values) = VAL_NULL(values+1) = 0;
427 427
 
428 428
 	VAL_INT(values) 	= cell->h_entry;
... ...
@@ -461,16 +461,16 @@ int update_dialog_dbinfo(struct dlg_cell * cell)
461 461
 	if((cell->dflags & DLG_FLAG_NEW) != 0){
462 462
 		/* save all the current dialogs information*/
463 463
 		VAL_TYPE(values) = VAL_TYPE(values+1) = VAL_TYPE(values+9) = 
464
-		VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB_INT;
464
+		VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB1_INT;
465 465
 
466 466
 		VAL_TYPE(values+2) = VAL_TYPE(values+3) = VAL_TYPE(values+4) = 
467 467
 		VAL_TYPE(values+5) = VAL_TYPE(values+6) = VAL_TYPE(values+7) = 
468 468
 		VAL_TYPE(values+8) = VAL_TYPE(values+12) = VAL_TYPE(values+13) = 
469 469
 		VAL_TYPE(values+14) = VAL_TYPE(values+15) = VAL_TYPE(values+16)=
470
-		VAL_TYPE(values+17) = DB_STR;
470
+		VAL_TYPE(values+17) = DB1_STR;
471 471
 
472 472
 		SET_NULL_FLAG(values, i, DIALOG_TABLE_COL_NO-6, 0);
473
-		VAL_TYPE(values+18) = VAL_TYPE(values+19) = DB_INT;
473
+		VAL_TYPE(values+18) = VAL_TYPE(values+19) = DB1_INT;
474 474
 
475 475
 		/* lock the entry */
476 476
 		entry = (d_table->entries)[cell->h_entry];
... ...
@@ -522,9 +522,9 @@ int update_dialog_dbinfo(struct dlg_cell * cell)
522 522
 	} else if((cell->dflags & DLG_FLAG_CHANGED) != 0) {
523 523
 		/* save only dialog's state and timeout */
524 524
 		VAL_TYPE(values) = VAL_TYPE(values+1) = 
525
-		VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB_INT;
525
+		VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB1_INT;
526 526
 
527
-		VAL_TYPE(values+12) = VAL_TYPE(values+13) =DB_STR;
527
+		VAL_TYPE(values+12) = VAL_TYPE(values+13) =DB1_STR;
528 528
 
529 529
 		/* lock the entry */
530 530
 		entry = (d_table->entries)[cell->h_entry];
... ...
@@ -585,17 +585,17 @@ void dialog_update_db(unsigned int ticks, void * param)
585 585
 
586 586
 	/*save the current dialogs information*/
587 587
 	VAL_TYPE(values) = VAL_TYPE(values+1) = VAL_TYPE(values+9) = 
588
-	VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB_INT;
588
+	VAL_TYPE(values+10) = VAL_TYPE(values+11) = DB1_INT;
589 589
 
590 590
 	VAL_TYPE(values+2) = VAL_TYPE(values+3) = VAL_TYPE(values+4) = 
591 591
 	VAL_TYPE(values+5) = VAL_TYPE(values+6) = VAL_TYPE(values+7) = 
592 592
 	VAL_TYPE(values+8) = VAL_TYPE(values+12) = VAL_TYPE(values+13) = 
593 593
 	VAL_TYPE(values+14) = VAL_TYPE(values+15) = VAL_TYPE(values+16) = 
594
-	VAL_TYPE(values+17) = DB_STR;
594
+	VAL_TYPE(values+17) = DB1_STR;
595 595
 
596 596
 	SET_NULL_FLAG(values, i, DIALOG_TABLE_COL_NO-6, 0);
597 597
 
598
-	VAL_TYPE(values+18) = VAL_TYPE(values+19) = DB_INT;
598
+	VAL_TYPE(values+18) = VAL_TYPE(values+19) = DB1_INT;
599 599
 
600 600
 	LM_DBG("saving current_info \n");
601 601
 	
... ...
@@ -29,7 +29,7 @@
29 29
 #define _DLG_DB_HANDLER_H_
30 30
 
31 31
 #include "../../str.h"
32
-#include "../../db/db.h"
32
+#include "../../lib/srdb1/db.h"
33 33
 
34 34
 #define CALL_ID_COL				"callid"
35 35
 #define FROM_URI_COL			"from_uri"
... ...
@@ -30,7 +30,7 @@
30 30
 
31 31
 #include "../../dprint.h"
32 32
 #include "../../ut.h"
33
-#include "../../db/db.h"
33
+#include "../../lib/srdb1/db.h"
34 34
 #include "../../dprint.h"
35 35
 #include "../../config.h"
36 36
 #include "../../socket_info.h"