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:33
Showing 2 changed files
... ...
@@ -12,4 +12,6 @@ LIBS=
12 12
 
13 13
 DEFS+=-DOPENSER_MOD_INTERFACE
14 14
 
15
+SERLIBPATH=../../lib
16
+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
15 17
 include ../../Makefile.modules
... ...
@@ -40,9 +40,9 @@
40 40
 #include <unistd.h>
41 41
 #include <stdlib.h>
42 42
 
43
-#include "../../db/db_op.h"
43
+#include "../../lib/srdb1/db_op.h"
44 44
 #include "../../sr_module.h"
45
-#include "../../db/db.h"
45
+#include "../../lib/srdb1/db.h"
46 46
 #include "../../mem/shm_mem.h"
47 47
 #include "../../mem/mem.h"
48 48
 #include "../../dprint.h"
... ...
@@ -67,7 +67,7 @@ int pdt_fetch_rows = 1000;
67 67
 pdt_tree_t **_ptree = NULL; 
68 68
 
69 69
 /** database connection */
70
-static db_con_t *db_con = NULL;
70
+static db1_con_t *db_con = NULL;
71 71
 static db_func_t pdt_dbf;
72 72
 
73 73
 
... ...
@@ -549,7 +549,7 @@ static int pdt_load_db(void)
549 549
 {
550 550
 	db_key_t db_cols[3] = {&sdomain_column, &prefix_column, &domain_column};
551 551
 	str p, d, sdomain;
552
-	db_res_t* db_res = NULL;
552
+	db1_res_t* db_res = NULL;
553 553
 	int i, ret;
554 554
 	pdt_tree_t *_ptree_new = NULL; 
555 555
 	pdt_tree_t *old_tree = NULL; 
... ...
@@ -776,17 +776,17 @@ struct mi_root* pdt_mi_add(struct mi_root* cmd_tree, void* param)
776 776
 		return init_mi_tree(400,
777 777
 				"(sdomain,prefix,domain) exists already", 38);
778 778
 	}
779
-	db_vals[0].type = DB_STR;
779
+	db_vals[0].type = DB1_STR;
780 780
 	db_vals[0].nul = 0;
781 781
 	db_vals[0].val.str_val.s = sdomain.s;
782 782
 	db_vals[0].val.str_val.len = sdomain.len;
783 783
 
784
-	db_vals[1].type = DB_STR;
784
+	db_vals[1].type = DB1_STR;
785 785
 	db_vals[1].nul = 0;
786 786
 	db_vals[1].val.str_val.s = sp.s;
787 787
 	db_vals[1].val.str_val.len = sp.len;
788 788
 
789
-	db_vals[2].type = DB_STR;
789
+	db_vals[2].type = DB1_STR;
790 790
 	db_vals[2].nul = 0;
791 791
 	db_vals[2].val.str_val.s = sd.s;
792 792
 	db_vals[2].val.str_val.len = sd.len;
... ...
@@ -861,12 +861,12 @@ struct mi_root* pdt_mi_delete(struct mi_root* cmd_tree, void* param)
861 861
 		 return init_mi_tree( 400, "empty param", 11);
862 862
 
863 863
 
864
-	db_vals[0].type = DB_STR;
864
+	db_vals[0].type = DB1_STR;
865 865
 	db_vals[0].nul = 0;
866 866
 	db_vals[0].val.str_val.s = sdomain.s;
867 867
 	db_vals[0].val.str_val.len = sdomain.len;
868 868
 	
869
-	db_vals[1].type = DB_STR;
869
+	db_vals[1].type = DB1_STR;
870 870
 	db_vals[1].nul = 0;
871 871
 	db_vals[1].val.str_val.s = sd.s;
872 872
 	db_vals[1].val.str_val.len = sd.len;