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:36
Showing 4 changed files
... ...
@@ -16,4 +16,6 @@ LIBS+=-L$(SYSBASE)/include/lib  -L$(LOCALBASE)/lib -lxml2
16 16
 
17 17
 DEFS+=-DOPENSER_MOD_INTERFACE
18 18
 
19
+SERLIBPATH=../../lib
20
+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
19 21
 include ../../Makefile.modules
... ...
@@ -93,7 +93,7 @@ int disable_bla      = 0;
93 93
 struct sl_binds slb;
94 94
 
95 95
 /* database connection */
96
-db_con_t *pxml_db = NULL;
96
+db1_con_t *pxml_db = NULL;
97 97
 db_func_t pxml_dbf;
98 98
 
99 99
 /* functions imported from xcap_client module */
... ...
@@ -36,7 +36,7 @@
36 36
 #ifndef _PRES_XML_H_
37 37
 #define _PRES_XML_H_
38 38
 
39
-#include "../../db/db.h"
39
+#include "../../lib/srdb1/db.h"
40 40
 #include "../sl/sl_api.h"
41 41
 #include "../presence/event_list.h"
42 42
 #include "../presence/presence.h"
... ...
@@ -52,7 +52,7 @@ typedef struct xcap_serv
52 52
 
53 53
 extern str xcap_table;
54 54
 extern add_event_t pres_add_event;
55
-extern db_con_t *pxml_db;
55
+extern db1_con_t *pxml_db;
56 56
 extern db_func_t pxml_dbf;
57 57
 extern int force_active;
58 58
 extern int pidf_manipulation;
... ...
@@ -427,7 +427,7 @@ int get_rules_doc(str* user, str* domain, int type, str** rules_doc)
427 427
 	db_val_t query_vals[5];
428 428
 	db_key_t result_cols[3];
429 429
 	int n_query_cols = 0;
430
-	db_res_t *result = 0;
430
+	db1_res_t *result = 0;
431 431
 	db_row_t *row;
432 432
 	db_val_t *row_vals;
433 433
 	str body;
... ...
@@ -447,19 +447,19 @@ int get_rules_doc(str* user, str* domain, int type, str** rules_doc)
447 447
 			user->len, user->s,	domain->len, domain->s);
448 448
 	/* first search in database */
449 449
 	query_cols[n_query_cols] = &tmp1;
450
-	query_vals[n_query_cols].type = DB_STR;
450
+	query_vals[n_query_cols].type = DB1_STR;
451 451
 	query_vals[n_query_cols].nul = 0;
452 452
 	query_vals[n_query_cols].val.str_val = *user;
453 453
 	n_query_cols++;
454 454
 	
455 455
 	query_cols[n_query_cols] = &tmp2;
456
-	query_vals[n_query_cols].type = DB_STR;
456
+	query_vals[n_query_cols].type = DB1_STR;
457 457
 	query_vals[n_query_cols].nul = 0;
458 458
 	query_vals[n_query_cols].val.str_val = *domain;
459 459
 	n_query_cols++;
460 460
 	
461 461
 	query_cols[n_query_cols] = &tmp3;
462
-	query_vals[n_query_cols].type = DB_INT;
462
+	query_vals[n_query_cols].type = DB1_INT;
463 463
 	query_vals[n_query_cols].nul = 0;
464 464
 	query_vals[n_query_cols].val.int_val= type;
465 465
 	n_query_cols++;