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:35
Showing 8 changed files
... ...
@@ -18,4 +18,5 @@ DEFS+=-DOPENSER_MOD_INTERFACE
18 18
 
19 19
 SERLIBPATH=../../lib
20 20
 SER_LIBS+=$(SERLIBPATH)/kmi/kmi
21
+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
21 22
 include ../../Makefile.modules
... ...
@@ -41,8 +41,8 @@
41 41
 #include "../../ut.h"
42 42
 #include "../../globals.h"
43 43
 #include "../../str.h"
44
-#include "../../db/db.h"
45
-#include "../../db/db_val.h"
44
+#include "../../lib/srdb1/db.h"
45
+#include "../../lib/srdb1/db_val.h"
46 46
 #include "../../socket_info.h"
47 47
 #include "../tm/tm_load.h"
48 48
 #include "../pua/hash.h"
... ...
@@ -260,7 +260,7 @@ int get_wi_subs_db(subs_t* subs, watcher_t* watchers)
260 260
 	db_op_t  query_ops[6];
261 261
 	db_val_t query_vals[6];
262 262
 	db_key_t result_cols[6];
263
-	db_res_t *result = NULL;
263
+	db1_res_t *result = NULL;
264 264
 	db_row_t *row = NULL ;	
265 265
 	db_val_t *row_vals = NULL;
266 266
 	int n_result_cols = 0;
... ...
@@ -270,14 +270,14 @@ int get_wi_subs_db(subs_t* subs, watcher_t* watchers)
270 270
 
271 271
 	query_cols[n_query_cols] = &str_presentity_uri_col;
272 272
 	query_ops[n_query_cols] = OP_EQ;
273
-	query_vals[n_query_cols].type = DB_STR;
273
+	query_vals[n_query_cols].type = DB1_STR;
274 274
 	query_vals[n_query_cols].nul = 0;
275 275
 	query_vals[n_query_cols].val.str_val= subs->pres_uri;
276 276
 	n_query_cols++;
277 277
 
278 278
 	query_cols[n_query_cols] = &str_event_col;
279 279
 	query_ops[n_query_cols] = OP_EQ;
280
-	query_vals[n_query_cols].type = DB_STR;
280
+	query_vals[n_query_cols].type = DB1_STR;
281 281
 	query_vals[n_query_cols].nul = 0;
282 282
 	query_vals[n_query_cols].val.str_val = subs->event->wipeer->name;
283 283
 	n_query_cols++;
... ...
@@ -612,7 +612,7 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
612 612
 	db_key_t query_cols[6];
613 613
 	db_val_t query_vals[6];
614 614
 	db_key_t result_cols[6];
615
-	db_res_t *result = NULL;
615
+	db1_res_t *result = NULL;
616 616
 	int body_col, expires_col, etag_col= 0, sender_col;
617 617
 	str** body_array= NULL;
618 618
 	str* notify_body= NULL;	
... ...
@@ -656,19 +656,19 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
656 656
 db_query:
657 657
 
658 658
 	query_cols[n_query_cols] = &str_domain_col;
659
-	query_vals[n_query_cols].type = DB_STR;
659
+	query_vals[n_query_cols].type = DB1_STR;
660 660
 	query_vals[n_query_cols].nul = 0;
661 661
 	query_vals[n_query_cols].val.str_val = uri.host;
662 662
 	n_query_cols++;
663 663
 
664 664
 	query_cols[n_query_cols] = &str_username_col;
665
-	query_vals[n_query_cols].type = DB_STR;
665
+	query_vals[n_query_cols].type = DB1_STR;
666 666
 	query_vals[n_query_cols].nul = 0;
667 667
 	query_vals[n_query_cols].val.str_val = uri.user;
668 668
 	n_query_cols++;
669 669
 
670 670
 	query_cols[n_query_cols] = &str_event_col;
671
-	query_vals[n_query_cols].type = DB_STR;
671
+	query_vals[n_query_cols].type = DB1_STR;
672 672
 	query_vals[n_query_cols].nul = 0;
673 673
 	query_vals[n_query_cols].val.str_val= event->name;
674 674
 	n_query_cols++;
... ...
@@ -993,7 +993,7 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender,
993 993
 	int n_result_cols = 0, n_query_cols = 0;
994 994
 	db_row_t *row ;	
995 995
 	db_val_t *row_vals ;
996
-	db_res_t *result = NULL;
996
+	db1_res_t *result = NULL;
997 997
 	int from_user_col, from_domain_col, from_tag_col;
998 998
 	int to_user_col, to_domain_col, to_tag_col;
999 999
 	int expires_col= 0,callid_col, cseq_col, i, reason_col;
... ...
@@ -1011,28 +1011,28 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender,
1011 1011
 	LM_DBG("querying database table = active_watchers\n");
1012 1012
 	query_cols[n_query_cols] = &str_presentity_uri_col;
1013 1013
 	query_ops[n_query_cols] = OP_EQ;
1014
-	query_vals[n_query_cols].type = DB_STR;
1014
+	query_vals[n_query_cols].type = DB1_STR;
1015 1015
 	query_vals[n_query_cols].nul = 0;
1016 1016
 	query_vals[n_query_cols].val.str_val = *pres_uri;
1017 1017
 	n_query_cols++;
1018 1018
 	
1019 1019
 	query_cols[n_query_cols] = &str_event_col;
1020 1020
 	query_ops[n_query_cols] = OP_EQ;
1021
-	query_vals[n_query_cols].type = DB_STR;
1021
+	query_vals[n_query_cols].type = DB1_STR;
1022 1022
 	query_vals[n_query_cols].nul = 0;
1023 1023
 	query_vals[n_query_cols].val.str_val = event->name;
1024 1024
 	n_query_cols++;
1025 1025
 
1026 1026
 	query_cols[n_query_cols] = &str_status_col;
1027 1027
 	query_ops[n_query_cols] = OP_EQ;
1028
-	query_vals[n_query_cols].type = DB_INT;
1028
+	query_vals[n_query_cols].type = DB1_INT;
1029 1029
 	query_vals[n_query_cols].nul = 0;
1030 1030
 	query_vals[n_query_cols].val.int_val = ACTIVE_STATUS;
1031 1031
 	n_query_cols++;
1032 1032
 
1033 1033
 	query_cols[n_query_cols] = &str_contact_col;
1034 1034
 	query_ops[n_query_cols] = OP_NEQ;
1035
-	query_vals[n_query_cols].type = DB_STR;
1035
+	query_vals[n_query_cols].type = DB1_STR;
1036 1036
 	query_vals[n_query_cols].nul = 0;
1037 1037
 	if(sender)
1038 1038
 	{	
... ...
@@ -1879,7 +1879,7 @@ int add_waiting_watchers(watcher_t *watchers, str pres_uri, str event)
1879 1879
 	db_key_t query_cols[3];
1880 1880
 	db_val_t query_vals[3];
1881 1881
 	db_key_t result_cols[2];
1882
-	db_res_t *result = NULL;
1882
+	db1_res_t *result = NULL;
1883 1883
 	db_row_t *row= NULL ;	
1884 1884
 	db_val_t *row_vals;
1885 1885
 	int n_result_cols = 0;
... ...
@@ -1892,19 +1892,19 @@ int add_waiting_watchers(watcher_t *watchers, str pres_uri, str event)
1892 1892
 	 * to the presentity and have status pending */
1893 1893
 
1894 1894
 	query_cols[n_query_cols] = &str_presentity_uri_col;
1895
-	query_vals[n_query_cols].type = DB_STR;
1895
+	query_vals[n_query_cols].type = DB1_STR;
1896 1896
 	query_vals[n_query_cols].nul = 0;
1897 1897
 	query_vals[n_query_cols].val.str_val = pres_uri;
1898 1898
 	n_query_cols++;
1899 1899
 
1900 1900
 	query_cols[n_query_cols] = &str_event_col;
1901
-	query_vals[n_query_cols].type = DB_STR;
1901
+	query_vals[n_query_cols].type = DB1_STR;
1902 1902
 	query_vals[n_query_cols].nul = 0;
1903 1903
 	query_vals[n_query_cols].val.str_val = event;
1904 1904
 	n_query_cols++;
1905 1905
 
1906 1906
 	query_cols[n_query_cols] = &str_status_col;
1907
-	query_vals[n_query_cols].type = DB_INT;
1907
+	query_vals[n_query_cols].type = DB1_INT;
1908 1908
 	query_vals[n_query_cols].nul = 0;
1909 1909
 	query_vals[n_query_cols].val.int_val = PENDING_STATUS;
1910 1910
 	n_query_cols++;
... ...
@@ -51,7 +51,7 @@
51 51
 #include <fcntl.h>
52 52
 #include <time.h>
53 53
 
54
-#include "../../db/db.h"
54
+#include "../../lib/srdb1/db.h"
55 55
 #include "../../sr_module.h"
56 56
 #include "../../dprint.h"
57 57
 #include "../../error.h"
... ...
@@ -85,7 +85,7 @@ static int clean_period=100;
85 85
 static int db_update_period=100;
86 86
 
87 87
 /* database connection */
88
-db_con_t *pa_db = NULL;
88
+db1_con_t *pa_db = NULL;
89 89
 db_func_t pa_dbf;
90 90
 str presentity_table= str_init("presentity");
91 91
 str active_watchers_table = str_init("active_watchers");
... ...
@@ -632,22 +632,22 @@ int pres_update_status(subs_t subs, str reason, db_key_t* query_cols,
632 632
 	int status;
633 633
 	query_cols[q_wuser_col=n_query_cols]= &str_watcher_username_col;
634 634
 	query_vals[n_query_cols].nul= 0;
635
-	query_vals[n_query_cols].type= DB_STR;
635
+	query_vals[n_query_cols].type= DB1_STR;
636 636
 	n_query_cols++;
637 637
 
638 638
 	query_cols[q_wdomain_col=n_query_cols]= &str_watcher_domain_col;
639 639
 	query_vals[n_query_cols].nul= 0;
640
-	query_vals[n_query_cols].type= DB_STR;
640
+	query_vals[n_query_cols].type= DB1_STR;
641 641
 	n_query_cols++;
642 642
 
643 643
 	update_cols[u_status_col= n_update_cols]= &str_status_col;
644 644
 	update_vals[u_status_col].nul= 0;
645
-	update_vals[u_status_col].type= DB_INT;
645
+	update_vals[u_status_col].type= DB1_INT;
646 646
 	n_update_cols++;
647 647
 
648 648
 	update_cols[u_reason_col= n_update_cols]= &str_reason_col;
649 649
 	update_vals[u_reason_col].nul= 0;
650
-	update_vals[u_reason_col].type= DB_STR;
650
+	update_vals[u_reason_col].type= DB1_STR;
651 651
 	n_update_cols++;
652 652
 
653 653
 	status= subs.status;
... ...
@@ -714,25 +714,25 @@ int pres_db_delete_status(subs_t* s)
714 714
 
715 715
     query_cols[n_query_cols]= &str_event_col;
716 716
     query_vals[n_query_cols].nul= 0;
717
-    query_vals[n_query_cols].type= DB_STR;
717
+    query_vals[n_query_cols].type= DB1_STR;
718 718
     query_vals[n_query_cols].val.str_val= s->event->name ;
719 719
     n_query_cols++;
720 720
 
721 721
     query_cols[n_query_cols]= &str_presentity_uri_col;
722 722
     query_vals[n_query_cols].nul= 0;
723
-    query_vals[n_query_cols].type= DB_STR;
723
+    query_vals[n_query_cols].type= DB1_STR;
724 724
     query_vals[n_query_cols].val.str_val= s->pres_uri;
725 725
     n_query_cols++;
726 726
 
727 727
     query_cols[n_query_cols]= &str_watcher_username_col;
728 728
     query_vals[n_query_cols].nul= 0;
729
-    query_vals[n_query_cols].type= DB_STR;
729
+    query_vals[n_query_cols].type= DB1_STR;
730 730
     query_vals[n_query_cols].val.str_val= s->from_user;
731 731
     n_query_cols++;
732 732
 
733 733
     query_cols[n_query_cols]= &str_watcher_domain_col;
734 734
     query_vals[n_query_cols].nul= 0;
735
-    query_vals[n_query_cols].type= DB_STR;
735
+    query_vals[n_query_cols].type= DB1_STR;
736 736
     query_vals[n_query_cols].val.str_val= s->from_domain;
737 737
     n_query_cols++;
738 738
 
... ...
@@ -751,7 +751,7 @@ int update_watchers_status(str pres_uri, pres_ev_t* ev, str* rules_doc)
751 751
 	db_key_t query_cols[6], result_cols[5];
752 752
 	db_val_t query_vals[6];
753 753
 	int n_result_cols= 0, n_query_cols = 0;
754
-	db_res_t* result= NULL;
754
+	db1_res_t* result= NULL;
755 755
 	db_row_t *row;
756 756
 	db_val_t *row_vals ;
757 757
 	int i;
... ...
@@ -791,13 +791,13 @@ int update_watchers_status(str pres_uri, pres_ev_t* ev, str* rules_doc)
791 791
 	/* update in watchers_table */
792 792
 	query_cols[n_query_cols]= &str_presentity_uri_col;
793 793
 	query_vals[n_query_cols].nul= 0;
794
-	query_vals[n_query_cols].type= DB_STR;
794
+	query_vals[n_query_cols].type= DB1_STR;
795 795
 	query_vals[n_query_cols].val.str_val= pres_uri;
796 796
 	n_query_cols++;
797 797
 
798 798
 	query_cols[n_query_cols]= &str_event_col;
799 799
 	query_vals[n_query_cols].nul= 0;
800
-	query_vals[n_query_cols].type= DB_STR;
800
+	query_vals[n_query_cols].type= DB1_STR;
801 801
 	query_vals[n_query_cols].val.str_val= ev->name;
802 802
 	n_query_cols++;
803 803
 
... ...
@@ -39,7 +39,7 @@
39 39
 #include "../../parser/msg_parser.h"
40 40
 #include "../tm/tm_load.h"
41 41
 #include "../sl/sl_api.h"
42
-#include "../../db/db.h"
42
+#include "../../lib/srdb1/db.h"
43 43
 #include "../../parser/parse_from.h"
44 44
 #include "event_list.h"
45 45
 #include "hash.h"
... ...
@@ -48,7 +48,7 @@
48 48
 extern struct tm_binds tmb;
49 49
 /* DB module bind */
50 50
 extern db_func_t pa_dbf;
51
-extern db_con_t* pa_db;
51
+extern db1_con_t* pa_db;
52 52
 
53 53
 /* PRESENCE database */
54 54
 extern str db_url;
... ...
@@ -37,7 +37,7 @@
37 37
 #include <string.h>
38 38
 #include <time.h>
39 39
 
40
-#include "../../db/db.h"
40
+#include "../../lib/srdb1/db.h"
41 41
 #include "../../dprint.h"
42 42
 #include "../../mem/shm_mem.h"
43 43
 #include "../../str.h"
... ...
@@ -271,7 +271,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
271 271
 	db_key_t query_cols[12], update_keys[8], result_cols[5];
272 272
 	db_op_t  query_ops[12];
273 273
 	db_val_t query_vals[12], update_vals[8];
274
-	db_res_t *result= NULL;
274
+	db1_res_t *result= NULL;
275 275
 	int n_query_cols = 0;
276 276
 	int n_update_cols = 0;
277 277
 	char* dot= NULL;
... ...
@@ -306,28 +306,28 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
306 306
 
307 307
 	query_cols[n_query_cols] = &str_domain_col;
308 308
 	query_ops[n_query_cols] = OP_EQ;
309
-	query_vals[n_query_cols].type = DB_STR;
309
+	query_vals[n_query_cols].type = DB1_STR;
310 310
 	query_vals[n_query_cols].nul = 0;
311 311
 	query_vals[n_query_cols].val.str_val = presentity->domain;
312 312
 	n_query_cols++;
313 313
 	
314 314
 	query_cols[n_query_cols] = &str_username_col;
315 315
 	query_ops[n_query_cols] = OP_EQ;
316
-	query_vals[n_query_cols].type = DB_STR;
316
+	query_vals[n_query_cols].type = DB1_STR;
317 317
 	query_vals[n_query_cols].nul = 0;
318 318
 	query_vals[n_query_cols].val.str_val = presentity->user;
319 319
 	n_query_cols++;
320 320
 
321 321
 	query_cols[n_query_cols] = &str_event_col;
322 322
 	query_ops[n_query_cols] = OP_EQ;
323
-	query_vals[n_query_cols].type = DB_STR;
323
+	query_vals[n_query_cols].type = DB1_STR;
324 324
 	query_vals[n_query_cols].nul = 0;
325 325
 	query_vals[n_query_cols].val.str_val = presentity->event->name;
326 326
 	n_query_cols++;
327 327
 
328 328
 	query_cols[n_query_cols] = &str_etag_col;
329 329
 	query_ops[n_query_cols] = OP_EQ;
330
-	query_vals[n_query_cols].type = DB_STR;
330
+	query_vals[n_query_cols].type = DB1_STR;
331 331
 	query_vals[n_query_cols].nul = 0;
332 332
 	query_vals[n_query_cols].val.str_val = presentity->etag;
333 333
 	n_query_cols++;
... ...
@@ -347,7 +347,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
347 347
 		
348 348
 		/* insert new record into database */	
349 349
 		query_cols[n_query_cols] = &str_expires_col;
350
-		query_vals[n_query_cols].type = DB_INT;
350
+		query_vals[n_query_cols].type = DB1_INT;
351 351
 		query_vals[n_query_cols].nul = 0;
352 352
 		query_vals[n_query_cols].val.int_val = presentity->expires+
353 353
 				(int)time(NULL);
... ...
@@ -356,7 +356,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
356 356
 		if( presentity->sender)
357 357
 		{
358 358
 			query_cols[n_query_cols] = &str_sender_col;
359
-			query_vals[n_query_cols].type = DB_STR;
359
+			query_vals[n_query_cols].type = DB1_STR;
360 360
 			query_vals[n_query_cols].nul = 0;
361 361
 			query_vals[n_query_cols].val.str_val.s = presentity->sender->s;
362 362
 			query_vals[n_query_cols].val.str_val.len = presentity->sender->len;
... ...
@@ -364,13 +364,13 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
364 364
 		}
365 365
 
366 366
 		query_cols[n_query_cols] = &str_body_col;
367
-		query_vals[n_query_cols].type = DB_BLOB;
367
+		query_vals[n_query_cols].type = DB1_BLOB;
368 368
 		query_vals[n_query_cols].nul = 0;
369 369
 		query_vals[n_query_cols].val.str_val = *body;
370 370
 		n_query_cols++;
371 371
 		
372 372
 		query_cols[n_query_cols] = &str_received_time_col;
373
-		query_vals[n_query_cols].type = DB_INT;
373
+		query_vals[n_query_cols].type = DB1_INT;
374 374
 		query_vals[n_query_cols].nul = 0;
375 375
 		query_vals[n_query_cols].val.int_val = presentity->received_time;
376 376
 		n_query_cols++;
... ...
@@ -549,7 +549,7 @@ after_dialog_check:
549 549
 				cur_etag= etag;
550 550
 
551 551
 				update_keys[n_update_cols] = &str_etag_col;
552
-				update_vals[n_update_cols].type = DB_STR;
552
+				update_vals[n_update_cols].type = DB1_STR;
553 553
 				update_vals[n_update_cols].nul = 0;
554 554
 				update_vals[n_update_cols].val.str_val = etag;
555 555
 				n_update_cols++;
... ...
@@ -559,14 +559,14 @@ after_dialog_check:
559 559
 				cur_etag= presentity->etag;
560 560
 			
561 561
 			update_keys[n_update_cols] = &str_expires_col;
562
-			update_vals[n_update_cols].type = DB_INT;
562
+			update_vals[n_update_cols].type = DB1_INT;
563 563
 			update_vals[n_update_cols].nul = 0;
564 564
 			update_vals[n_update_cols].val.int_val= presentity->expires +
565 565
 				(int)time(NULL);
566 566
 			n_update_cols++;
567 567
 
568 568
 			update_keys[n_update_cols] = &str_received_time_col;
569
-			update_vals[n_update_cols].type = DB_INT;
569
+			update_vals[n_update_cols].type = DB1_INT;
570 570
 			update_vals[n_update_cols].nul = 0;
571 571
 			update_vals[n_update_cols].val.int_val= presentity->received_time;
572 572
 			n_update_cols++;
... ...
@@ -574,7 +574,7 @@ after_dialog_check:
574 574
 			if(body && body->s)
575 575
 			{
576 576
 				update_keys[n_update_cols] = &str_body_col;
577
-				update_vals[n_update_cols].type = DB_BLOB;
577
+				update_vals[n_update_cols].type = DB1_BLOB;
578 578
 				update_vals[n_update_cols].nul = 0;
579 579
 				update_vals[n_update_cols].val.str_val = *body;
580 580
 				n_update_cols++;
... ...
@@ -594,7 +594,7 @@ after_dialog_check:
594 594
 			if( presentity->sender)
595 595
 			{
596 596
 				update_keys[n_update_cols] = &str_sender_col;
597
-				update_vals[n_update_cols].type = DB_STR;
597
+				update_vals[n_update_cols].type = DB1_STR;
598 598
 				update_vals[n_update_cols].nul = 0;
599 599
 				update_vals[n_update_cols].val.str_val = *presentity->sender;
600 600
 				n_update_cols++;
... ...
@@ -683,7 +683,7 @@ int pres_htable_restore(void)
683 683
 	/* query all records from presentity table and insert records 
684 684
 	 * in presentity table */
685 685
 	db_key_t result_cols[6];
686
-	db_res_t *result= NULL;
686
+	db1_res_t *result= NULL;
687 687
 	db_row_t *row= NULL ;	
688 688
 	db_val_t *row_vals;
689 689
 	int  i;
... ...
@@ -858,7 +858,7 @@ char* get_sphere(str* pres_uri)
858 858
 	db_key_t query_cols[6];
859 859
 	db_val_t query_vals[6];
860 860
 	db_key_t result_cols[6];
861
-	db_res_t *result = NULL;
861
+	db1_res_t *result = NULL;
862 862
 	db_row_t *row= NULL ;	
863 863
 	db_val_t *row_vals;
864 864
 	int n_result_cols = 0;
... ...
@@ -908,19 +908,19 @@ char* get_sphere(str* pres_uri)
908 908
 	}
909 909
 
910 910
 	query_cols[n_query_cols] = &str_domain_col;
911
-	query_vals[n_query_cols].type = DB_STR;
911
+	query_vals[n_query_cols].type = DB1_STR;
912 912
 	query_vals[n_query_cols].nul = 0;
913 913
 	query_vals[n_query_cols].val.str_val = uri.host;
914 914
 	n_query_cols++;
915 915
 
916 916
 	query_cols[n_query_cols] = &str_username_col;
917
-	query_vals[n_query_cols].type = DB_STR;
917
+	query_vals[n_query_cols].type = DB1_STR;
918 918
 	query_vals[n_query_cols].nul = 0;
919 919
 	query_vals[n_query_cols].val.str_val = uri.user;
920 920
 	n_query_cols++;
921 921
 
922 922
 	query_cols[n_query_cols] = &str_event_col;
923
-	query_vals[n_query_cols].type = DB_STR;
923
+	query_vals[n_query_cols].type = DB1_STR;
924 924
 	query_vals[n_query_cols].nul = 0;
925 925
 	query_vals[n_query_cols].val.str_val.s= "presence";
926 926
 	query_vals[n_query_cols].val.str_val.len= 8;
... ...
@@ -44,7 +44,7 @@
44 44
 #include "../../lock_ops.h"
45 45
 #include "../../hash_func.h"
46 46
 #include "../../cmpapi.h"
47
-#include "../../db/db.h"
47
+#include "../../lib/srdb1/db.h"
48 48
 #include "presence.h"
49 49
 #include "notify.h"
50 50
 #include "utils_func.h"
... ...
@@ -70,7 +70,7 @@ void msg_presentity_clean(unsigned int ticks,void *param)
70 70
 	db_val_t db_vals[2];
71 71
 	db_op_t  db_ops[2] ;
72 72
 	db_key_t result_cols[6];
73
-	db_res_t *result = NULL;
73
+	db1_res_t *result = NULL;
74 74
 	db_row_t *row ;	
75 75
 	db_val_t *row_vals ;
76 76
 	int i =0, size= 0;
... ...
@@ -94,7 +94,7 @@ void msg_presentity_clean(unsigned int ticks,void *param)
94 94
 
95 95
 	db_keys[0] = &str_expires_col;
96 96
 	db_ops[0] = OP_LT;
97
-	db_vals[0].type = DB_INT;
97
+	db_vals[0].type = DB1_INT;
98 98
 	db_vals[0].nul = 0;
99 99
 	db_vals[0].val.int_val = (int)time(NULL);
100 100
 		
... ...
@@ -143,19 +143,19 @@ int delete_db_subs(str pres_uri, str ev_stored_name, str to_tag)
143 143
 	int n_query_cols= 0;
144 144
 
145 145
 	query_cols[n_query_cols] = &str_presentity_uri_col;
146
-	query_vals[n_query_cols].type = DB_STR;
146
+	query_vals[n_query_cols].type = DB1_STR;
147 147
 	query_vals[n_query_cols].nul = 0;
148 148
 	query_vals[n_query_cols].val.str_val = pres_uri;
149 149
 	n_query_cols++;
150 150
 
151 151
 	query_cols[n_query_cols] = &str_event_col;
152
-	query_vals[n_query_cols].type = DB_STR;
152
+	query_vals[n_query_cols].type = DB1_STR;
153 153
 	query_vals[n_query_cols].nul = 0;
154 154
 	query_vals[n_query_cols].val.str_val = ev_stored_name;
155 155
 	n_query_cols++;
156 156
 
157 157
 	query_cols[n_query_cols] = &str_to_tag_col;
158
-	query_vals[n_query_cols].type = DB_STR;
158
+	query_vals[n_query_cols].type = DB1_STR;
159 159
 	query_vals[n_query_cols].nul = 0;
160 160
 	query_vals[n_query_cols].val.str_val = to_tag;
161 161
 	n_query_cols++;
... ...
@@ -184,25 +184,25 @@ int update_subs_db(subs_t* subs, int type)
184 184
 	int n_query_cols = 0;
185 185
 
186 186
 	query_cols[n_query_cols] = &str_presentity_uri_col;
187
-	query_vals[n_query_cols].type = DB_STR;
187
+	query_vals[n_query_cols].type = DB1_STR;
188 188
 	query_vals[n_query_cols].nul = 0;
189 189
 	query_vals[n_query_cols].val.str_val = subs->pres_uri;
190 190
 	n_query_cols++;
191 191
 	
192 192
 	query_cols[n_query_cols] = &str_watcher_username_col;
193
-	query_vals[n_query_cols].type = DB_STR;
193
+	query_vals[n_query_cols].type = DB1_STR;
194 194
 	query_vals[n_query_cols].nul = 0;
195 195
 	query_vals[n_query_cols].val.str_val = subs->from_user;
196 196
 	n_query_cols++;
197 197
 	
198 198
 	query_cols[n_query_cols] = &str_watcher_domain_col;
199
-	query_vals[n_query_cols].type = DB_STR;
199
+	query_vals[n_query_cols].type = DB1_STR;
200 200
 	query_vals[n_query_cols].nul = 0;
201 201
 	query_vals[n_query_cols].val.str_val = subs->from_domain;
202 202
 	n_query_cols++;
203 203
 
204 204
 	query_cols[n_query_cols] = &str_event_col;
205
-	query_vals[n_query_cols].type = DB_STR;
205
+	query_vals[n_query_cols].type = DB1_STR;
206 206
 	query_vals[n_query_cols].nul = 0;
207 207
 	query_vals[n_query_cols].val.str_val = subs->event->name;
208 208
 	n_query_cols++;
... ...
@@ -210,25 +210,25 @@ int update_subs_db(subs_t* subs, int type)
210 210
 	if(subs->event_id.s)
211 211
 	{
212 212
 		query_cols[n_query_cols] = &str_event_id_col;
213
-		query_vals[n_query_cols].type = DB_STR;
213
+		query_vals[n_query_cols].type = DB1_STR;
214 214
 		query_vals[n_query_cols].nul = 0;
215 215
 		query_vals[n_query_cols].val.str_val = subs->event_id;
216 216
 		n_query_cols++;
217 217
 	}
218 218
 	query_cols[n_query_cols] = &str_callid_col;
219
-	query_vals[n_query_cols].type = DB_STR;
219
+	query_vals[n_query_cols].type = DB1_STR;
220 220
 	query_vals[n_query_cols].nul = 0;
221 221
 	query_vals[n_query_cols].val.str_val = subs->callid;
222 222
 	n_query_cols++;
223 223
 
224 224
 	query_cols[n_query_cols] = &str_to_tag_col;
225
-	query_vals[n_query_cols].type = DB_STR;
225
+	query_vals[n_query_cols].type = DB1_STR;
226 226
 	query_vals[n_query_cols].nul = 0;
227 227
 	query_vals[n_query_cols].val.str_val = subs->to_tag;
228 228
 	n_query_cols++;
229 229
 
230 230
 	query_cols[n_query_cols] = &str_from_tag_col;
231
-	query_vals[n_query_cols].type = DB_STR;
231
+	query_vals[n_query_cols].type = DB1_STR;
232 232
 	query_vals[n_query_cols].nul = 0;
233 233
 	query_vals[n_query_cols].val.str_val = subs->from_tag;
234 234
 	n_query_cols++;
... ...
@@ -236,13 +236,13 @@ int update_subs_db(subs_t* subs, int type)
236 236
 	if(type & REMOTE_TYPE)
237 237
 	{
238 238
 		update_keys[n_update_cols] = &str_expires_col;
239
-		update_vals[n_update_cols].type = DB_INT;
239
+		update_vals[n_update_cols].type = DB1_INT;
240 240
 		update_vals[n_update_cols].nul = 0;
241 241
 		update_vals[n_update_cols].val.int_val = subs->expires + (int)time(NULL);
242 242
 		n_update_cols++;
243 243
 	
244 244
 		update_keys[n_update_cols] = &str_remote_cseq_col;
245
-		update_vals[n_update_cols].type = DB_INT;
245
+		update_vals[n_update_cols].type = DB1_INT;
246 246
 		update_vals[n_update_cols].nul = 0;
247 247
 		update_vals[n_update_cols].val.int_val = subs->remote_cseq; 
248 248
 		n_update_cols++;
... ...
@@ -250,26 +250,26 @@ int update_subs_db(subs_t* subs, int type)
250 250
 	else
251 251
 	{	
252 252
 		update_keys[n_update_cols] = &str_local_cseq_col;
253
-		update_vals[n_update_cols].type = DB_INT;
253
+		update_vals[n_update_cols].type = DB1_INT;
254 254
 		update_vals[n_update_cols].nul = 0;
255 255
 		update_vals[n_update_cols].val.int_val = subs->local_cseq+ 1;
256 256
 		n_update_cols++;
257 257
 	
258 258
 		update_keys[n_update_cols] = &str_version_col;
259
-		update_vals[n_update_cols].type = DB_INT;
259
+		update_vals[n_update_cols].type = DB1_INT;
260 260
 		update_vals[n_update_cols].nul = 0;
261 261
 		update_vals[n_update_cols].val.int_val = subs->version+ 1;
262 262
 		n_update_cols++;
263 263
 	}
264 264
 
265 265
 	update_keys[n_update_cols] = &str_status_col;
266
-	update_vals[n_update_cols].type = DB_INT;
266
+	update_vals[n_update_cols].type = DB1_INT;
267 267
 	update_vals[n_update_cols].nul = 0;
268 268
 	update_vals[n_update_cols].val.int_val = subs->status;
269 269
 	n_update_cols++;
270 270
 
271 271
 	update_keys[n_update_cols] = &str_reason_col;
272
-	update_vals[n_update_cols].type = DB_STR;
272
+	update_vals[n_update_cols].type = DB1_STR;
273 273
 	update_vals[n_update_cols].nul = 0;
274 274
 	update_vals[n_update_cols].val.str_val = subs->reason;
275 275
 	n_update_cols++;
... ...
@@ -457,19 +457,19 @@ void msg_watchers_clean(unsigned int ticks,void *param)
457 457
 	db_key_t db_keys[3], result_cols[1];
458 458
 	db_val_t db_vals[3];
459 459
 	db_op_t  db_ops[3] ;
460
-	db_res_t *result= NULL;
460
+	db1_res_t *result= NULL;
461 461
 
462 462
 	LM_DBG("cleaning pending subscriptions\n");
463 463
 	
464 464
 	db_keys[0] = &str_inserted_time_col;
465 465
 	db_ops[0] = OP_LT;
466
-	db_vals[0].type = DB_INT;
466
+	db_vals[0].type = DB1_INT;
467 467
 	db_vals[0].nul = 0;
468 468
 	db_vals[0].val.int_val = (int)time(NULL)- 24*3600 ;
469 469
 
470 470
 	db_keys[1] = &str_status_col;
471 471
 	db_ops [1] = OP_EQ;
472
-	db_vals[1].type = DB_INT;
472
+	db_vals[1].type = DB1_INT;
473 473
 	db_vals[1].nul = 0;
474 474
 	db_vals[1].val.int_val = PENDING_STATUS;
475 475
 	
... ...
@@ -1119,7 +1119,7 @@ int get_database_info(struct sip_msg* msg, subs_t* subs, int* reply_code, str* r
1119 1119
 	db_key_t query_cols[10];
1120 1120
 	db_val_t query_vals[10];
1121 1121
 	db_key_t result_cols[9];
1122
-	db_res_t *result= NULL;
1122
+	db1_res_t *result= NULL;
1123 1123
 	db_row_t *row ;	
1124 1124
 	db_val_t *row_vals ;
1125 1125
 	int n_query_cols = 0;
... ...
@@ -1132,37 +1132,37 @@ int get_database_info(struct sip_msg* msg, subs_t* subs, int* reply_code, str* r
1132 1132
 	str reason;
1133 1133
 
1134 1134
 	query_cols[n_query_cols] = &str_to_user_col;
1135
-	query_vals[n_query_cols].type = DB_STR;
1135
+	query_vals[n_query_cols].type = DB1_STR;
1136 1136
 	query_vals[n_query_cols].nul = 0;
1137 1137
 	query_vals[n_query_cols].val.str_val = subs->to_user;
1138 1138
 	n_query_cols++;
1139 1139
 	
1140 1140
 	query_cols[n_query_cols] = &str_to_domain_col;
1141
-	query_vals[n_query_cols].type = DB_STR;
1141
+	query_vals[n_query_cols].type = DB1_STR;
1142 1142
 	query_vals[n_query_cols].nul = 0;
1143 1143
 	query_vals[n_query_cols].val.str_val = subs->to_domain;
1144 1144
 	n_query_cols++;
1145 1145
 
1146 1146
 	query_cols[n_query_cols] = &str_watcher_username_col;
1147
-	query_vals[n_query_cols].type = DB_STR;
1147
+	query_vals[n_query_cols].type = DB1_STR;
1148 1148
 	query_vals[n_query_cols].nul = 0;
1149 1149
 	query_vals[n_query_cols].val.str_val = subs->from_user;
1150 1150
 	n_query_cols++;
1151 1151
 	
1152 1152
 	query_cols[n_query_cols] = &str_watcher_domain_col;
1153
-	query_vals[n_query_cols].type = DB_STR;
1153
+	query_vals[n_query_cols].type = DB1_STR;
1154 1154
 	query_vals[n_query_cols].nul = 0;
1155 1155
 	query_vals[n_query_cols].val.str_val = subs->from_domain;
1156 1156
 	n_query_cols++;
1157 1157
 
1158 1158
 	query_cols[n_query_cols] = &str_event_col;
1159
-	query_vals[n_query_cols].type = DB_STR;
1159
+	query_vals[n_query_cols].type = DB1_STR;
1160 1160
 	query_vals[n_query_cols].nul = 0;
1161 1161
 	query_vals[n_query_cols].val.str_val = subs->event->name;
1162 1162
 	n_query_cols++;
1163 1163
 
1164 1164
 	query_cols[n_query_cols] = &str_event_id_col;
1165
-	query_vals[n_query_cols].type = DB_STR;
1165
+	query_vals[n_query_cols].type = DB1_STR;
1166 1166
 	query_vals[n_query_cols].nul = 0;
1167 1167
 	if( subs->event_id.s != NULL)
1168 1168
 	{
... ...
@@ -1175,19 +1175,19 @@ int get_database_info(struct sip_msg* msg, subs_t* subs, int* reply_code, str* r
1175 1175
 	n_query_cols++;
1176 1176
 	
1177 1177
 	query_cols[n_query_cols] = &str_callid_col;
1178
-	query_vals[n_query_cols].type = DB_STR;
1178
+	query_vals[n_query_cols].type = DB1_STR;
1179 1179
 	query_vals[n_query_cols].nul = 0;
1180 1180
 	query_vals[n_query_cols].val.str_val = subs->callid;
1181 1181
 	n_query_cols++;
1182 1182
 
1183 1183
 	query_cols[n_query_cols] = &str_to_tag_col;
1184
-	query_vals[n_query_cols].type = DB_STR;
1184
+	query_vals[n_query_cols].type = DB1_STR;
1185 1185
 	query_vals[n_query_cols].nul = 0;
1186 1186
 	query_vals[n_query_cols].val.str_val = subs->to_tag;
1187 1187
 	n_query_cols++;
1188 1188
 
1189 1189
 	query_cols[n_query_cols] = &str_from_tag_col;
1190
-	query_vals[n_query_cols].type = DB_STR;
1190
+	query_vals[n_query_cols].type = DB1_STR;
1191 1191
 	query_vals[n_query_cols].nul = 0;
1192 1192
 	query_vals[n_query_cols].val.str_val = subs->from_tag;
1193 1193
 	n_query_cols++;
... ...
@@ -1337,7 +1337,7 @@ void timer_db_update(unsigned int ticks,void *param)
1337 1337
 
1338 1338
 }
1339 1339
 
1340
-void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table,
1340
+void update_db_subs(db1_con_t *db,db_func_t dbf, shtable_t hash_table,
1341 1341
 	int htable_size, int no_lock, handle_expired_func_t handle_expired_func)
1342 1342
 {	
1343 1343
 	db_key_t query_cols[22], update_cols[7];
... ...
@@ -1356,135 +1356,135 @@ void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table,
1356 1356
 	int n_query_update;
1357 1357
 
1358 1358
 	query_cols[pres_uri_col= n_query_cols] =&str_presentity_uri_col;
1359
-	query_vals[pres_uri_col].type = DB_STR;
1359
+	query_vals[pres_uri_col].type = DB1_STR;
1360 1360
 	query_vals[pres_uri_col].nul = 0;
1361 1361
 	n_query_cols++;
1362 1362
 	
1363 1363
 	query_cols[callid_col= n_query_cols] =&str_callid_col;
1364
-	query_vals[callid_col].type = DB_STR;
1364
+	query_vals[callid_col].type = DB1_STR;
1365 1365
 	query_vals[callid_col].nul = 0;
1366 1366
 	n_query_cols++;
1367 1367
 
1368 1368
 	query_cols[totag_col= n_query_cols] =&str_to_tag_col;
1369
-	query_vals[totag_col].type = DB_STR;
1369
+	query_vals[totag_col].type = DB1_STR;
1370 1370
 	query_vals[totag_col].nul = 0;
1371 1371
 	n_query_cols++;
1372 1372
 
1373 1373
 	query_cols[fromtag_col= n_query_cols] =&str_from_tag_col;
1374
-	query_vals[fromtag_col].type = DB_STR;
1374
+	query_vals[fromtag_col].type = DB1_STR;
1375 1375
 	query_vals[fromtag_col].nul = 0;
1376 1376
 	n_query_cols++;
1377 1377
 
1378 1378
 	n_query_update= n_query_cols;
1379 1379
 
1380 1380
 	query_cols[to_user_col= n_query_cols] =&str_to_user_col;
1381
-	query_vals[to_user_col].type = DB_STR;
1381
+	query_vals[to_user_col].type = DB1_STR;
1382 1382
 	query_vals[to_user_col].nul = 0;
1383 1383
 	n_query_cols++;
1384 1384
 
1385 1385
 	query_cols[to_domain_col= n_query_cols] =&str_to_domain_col;
1386
-	query_vals[to_domain_col].type = DB_STR;
1386
+	query_vals[to_domain_col].type = DB1_STR;
1387 1387
 	query_vals[to_domain_col].nul = 0;
1388 1388
 	n_query_cols++;
1389 1389
 	
1390 1390
 	query_cols[from_user_col= n_query_cols] =&str_watcher_username_col;
1391
-	query_vals[from_user_col].type = DB_STR;
1391
+	query_vals[from_user_col].type = DB1_STR;
1392 1392
 	query_vals[from_user_col].nul = 0;
1393 1393
 	n_query_cols++;
1394 1394
 
1395 1395
 	query_cols[from_domain_col= n_query_cols] =&str_watcher_domain_col;
1396
-	query_vals[from_domain_col].type = DB_STR;
1396
+	query_vals[from_domain_col].type = DB1_STR;
1397 1397
 	query_vals[from_domain_col].nul = 0;
1398 1398
 	n_query_cols++;
1399 1399
 
1400 1400
 	query_cols[event_col= n_query_cols] =&str_event_col;
1401
-	query_vals[event_col].type = DB_STR;
1401
+	query_vals[event_col].type = DB1_STR;
1402 1402
 	query_vals[event_col].nul = 0;
1403 1403
 	n_query_cols++;	
1404 1404
 
1405 1405
 	query_cols[event_id_col= n_query_cols] =&str_event_id_col;
1406
-	query_vals[event_id_col].type = DB_STR;
1406
+	query_vals[event_id_col].type = DB1_STR;
1407 1407
 	query_vals[event_id_col].nul = 0;
1408 1408
 	n_query_cols++;
1409 1409
 
1410 1410
 	query_cols[local_cseq_col= n_query_cols]=&str_local_cseq_col;
1411
-	query_vals[local_cseq_col].type = DB_INT;
1411
+	query_vals[local_cseq_col].type = DB1_INT;
1412 1412
 	query_vals[local_cseq_col].nul = 0;
1413 1413
 	n_query_cols++;
1414 1414
 
1415 1415
 	query_cols[remote_cseq_col= n_query_cols]=&str_remote_cseq_col;
1416
-	query_vals[remote_cseq_col].type = DB_INT;
1416
+	query_vals[remote_cseq_col].type = DB1_INT;
1417 1417
 	query_vals[remote_cseq_col].nul = 0;
1418 1418
 	n_query_cols++;
1419 1419
 
1420 1420
 	query_cols[expires_col= n_query_cols] =&str_expires_col;
1421
-	query_vals[expires_col].type = DB_INT;
1421
+	query_vals[expires_col].type = DB1_INT;
1422 1422
 	query_vals[expires_col].nul = 0;
1423 1423
 	n_query_cols++;
1424 1424
 
1425 1425
 	query_cols[status_col= n_query_cols] =&str_status_col;
1426
-	query_vals[status_col].type = DB_INT;
1426
+	query_vals[status_col].type = DB1_INT;
1427 1427
 	query_vals[status_col].nul = 0;
1428 1428
 	n_query_cols++;
1429 1429
 
1430 1430
 	query_cols[reason_col= n_query_cols] =&str_reason_col;
1431
-	query_vals[reason_col].type = DB_STR;
1431
+	query_vals[reason_col].type = DB1_STR;
1432 1432
 	query_vals[reason_col].nul = 0;
1433 1433
 	n_query_cols++;
1434 1434
 
1435 1435
 	query_cols[record_route_col= n_query_cols] =&str_record_route_col;
1436
-	query_vals[record_route_col].type = DB_STR;
1436
+	query_vals[record_route_col].type = DB1_STR;
1437 1437
 	query_vals[record_route_col].nul = 0;
1438 1438
 	n_query_cols++;
1439 1439
 	
1440 1440
 	query_cols[contact_col= n_query_cols] =&str_contact_col;
1441
-	query_vals[contact_col].type = DB_STR;
1441
+	query_vals[contact_col].type = DB1_STR;
1442 1442
 	query_vals[contact_col].nul = 0;
1443 1443
 	n_query_cols++;
1444 1444
 
1445 1445
 	query_cols[local_contact_col= n_query_cols] =&str_local_contact_col;
1446
-	query_vals[local_contact_col].type = DB_STR;
1446
+	query_vals[local_contact_col].type = DB1_STR;
1447 1447
 	query_vals[local_contact_col].nul = 0;
1448 1448
 	n_query_cols++;
1449 1449
 
1450 1450
 	query_cols[socket_info_col= n_query_cols] =&str_socket_info_col;
1451
-	query_vals[socket_info_col].type = DB_STR;
1451
+	query_vals[socket_info_col].type = DB1_STR;
1452 1452
 	query_vals[socket_info_col].nul = 0;
1453 1453
 	n_query_cols++;
1454 1454
 
1455 1455
 	query_cols[version_col= n_query_cols]=&str_version_col;
1456
-	query_vals[version_col].type = DB_INT;
1456
+	query_vals[version_col].type = DB1_INT;
1457 1457
 	query_vals[version_col].nul = 0;
1458 1458
 	n_query_cols++;
1459 1459
 
1460 1460
 	/* cols and values used for update */
1461 1461
 	update_cols[u_expires_col= n_update_cols]= &str_expires_col;
1462
-	update_vals[u_expires_col].type = DB_INT;
1462
+	update_vals[u_expires_col].type = DB1_INT;
1463 1463
 	update_vals[u_expires_col].nul = 0;
1464 1464
 	n_update_cols++;
1465 1465
 
1466 1466
 	update_cols[u_status_col= n_update_cols]= &str_status_col;
1467
-	update_vals[u_status_col].type = DB_INT;
1467
+	update_vals[u_status_col].type = DB1_INT;
1468 1468
 	update_vals[u_status_col].nul = 0;
1469 1469
 	n_update_cols++;
1470 1470
 
1471 1471
 	update_cols[u_reason_col= n_update_cols]= &str_reason_col;
1472
-	update_vals[u_reason_col].type = DB_STR;
1472
+	update_vals[u_reason_col].type = DB1_STR;
1473 1473
 	update_vals[u_reason_col].nul = 0;
1474 1474
 	n_update_cols++;
1475 1475
 
1476 1476
 	update_cols[u_remote_cseq_col= n_update_cols]= &str_remote_cseq_col;
1477
-	update_vals[u_remote_cseq_col].type = DB_INT;
1477
+	update_vals[u_remote_cseq_col].type = DB1_INT;
1478 1478
 	update_vals[u_remote_cseq_col].nul = 0;
1479 1479
 	n_update_cols++;
1480 1480
 
1481 1481
 	update_cols[u_local_cseq_col= n_update_cols]= &str_local_cseq_col;
1482
-	update_vals[u_local_cseq_col].type = DB_INT;
1482
+	update_vals[u_local_cseq_col].type = DB1_INT;
1483 1483
 	update_vals[u_local_cseq_col].nul = 0;
1484 1484
 	n_update_cols++;
1485 1485
 	
1486 1486
 	update_cols[u_version_col= n_update_cols]= &str_version_col;
1487
-	update_vals[u_version_col].type = DB_INT;
1487
+	update_vals[u_version_col].type = DB1_INT;
1488 1488
 	update_vals[u_version_col].nul = 0;
1489 1489
 	n_update_cols++;
1490 1490
 
... ...
@@ -1618,7 +1618,7 @@ void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table,
1618 1618
 int restore_db_subs(void)
1619 1619
 {
1620 1620
 	db_key_t result_cols[22]; 
1621
-	db_res_t *res= NULL;
1621
+	db1_res_t *res= NULL;
1622 1622
 	db_row_t *row = NULL;	
1623 1623
 	db_val_t *row_vals= NULL;
1624 1624
 	int i;
... ...
@@ -1891,30 +1891,30 @@ int get_db_subs_auth(subs_t* subs, int* found)
1891 1891
 	db_val_t db_vals[5];
1892 1892
 	int n_query_cols= 0; 
1893 1893
 	db_key_t result_cols[3];
1894
-	db_res_t *result = NULL;
1894
+	db1_res_t *result = NULL;
1895 1895
 	db_row_t *row ;	
1896 1896
 	db_val_t *row_vals ;
1897 1897
 
1898 1898
 	db_keys[n_query_cols] =&str_presentity_uri_col;
1899
-	db_vals[n_query_cols].type = DB_STR;
1899
+	db_vals[n_query_cols].type = DB1_STR;
1900 1900
 	db_vals[n_query_cols].nul = 0;
1901 1901
 	db_vals[n_query_cols].val.str_val= subs->pres_uri;
1902 1902
 	n_query_cols++;
1903 1903
 
1904 1904
 	db_keys[n_query_cols] =&str_watcher_username_col;
1905
-	db_vals[n_query_cols].type = DB_STR;
1905
+	db_vals[n_query_cols].type = DB1_STR;
1906 1906
 	db_vals[n_query_cols].nul = 0;
1907 1907
 	db_vals[n_query_cols].val.str_val = subs->from_user;
1908 1908
 	n_query_cols++;
1909 1909
 
1910 1910
 	db_keys[n_query_cols] =&str_watcher_domain_col;
1911
-	db_vals[n_query_cols].type = DB_STR;
1911
+	db_vals[n_query_cols].type = DB1_STR;
1912 1912
 	db_vals[n_query_cols].nul = 0;
1913 1913
 	db_vals[n_query_cols].val.str_val = subs->from_domain;
1914 1914
 	n_query_cols++;
1915 1915
 	
1916 1916
 	db_keys[n_query_cols] =&str_event_col;
1917
-	db_vals[n_query_cols].type = DB_STR;
1917
+	db_vals[n_query_cols].type = DB1_STR;
1918 1918
 	db_vals[n_query_cols].nul = 0;
1919 1919
 	db_vals[n_query_cols].val.str_val = subs->event->name;
1920 1920
 	n_query_cols++;
... ...
@@ -1982,37 +1982,37 @@ int insert_db_subs_auth(subs_t* subs)
1982 1982
 	int n_query_cols= 0; 
1983 1983
 
1984 1984
 	db_keys[n_query_cols] =&str_presentity_uri_col;
1985
-	db_vals[n_query_cols].type = DB_STR;
1985
+	db_vals[n_query_cols].type = DB1_STR;
1986 1986
 	db_vals[n_query_cols].nul = 0;
1987 1987
 	db_vals[n_query_cols].val.str_val= subs->pres_uri;
1988 1988
 	n_query_cols++;
1989 1989
 
1990 1990
 	db_keys[n_query_cols] =&str_watcher_username_col;
1991
-	db_vals[n_query_cols].type = DB_STR;
1991
+	db_vals[n_query_cols].type = DB1_STR;
1992 1992
 	db_vals[n_query_cols].nul = 0;
1993 1993
 	db_vals[n_query_cols].val.str_val = subs->from_user;
1994 1994
 	n_query_cols++;
1995 1995
 
1996 1996
 	db_keys[n_query_cols] =&str_watcher_domain_col;
1997
-	db_vals[n_query_cols].type = DB_STR;
1997
+	db_vals[n_query_cols].type = DB1_STR;
1998 1998
 	db_vals[n_query_cols].nul = 0;
1999 1999
 	db_vals[n_query_cols].val.str_val = subs->from_domain;
2000 2000
 	n_query_cols++;
2001 2001
 	
2002 2002
 	db_keys[n_query_cols] =&str_event_col;
2003
-	db_vals[n_query_cols].type = DB_STR;
2003
+	db_vals[n_query_cols].type = DB1_STR;
2004 2004
 	db_vals[n_query_cols].nul = 0;
2005 2005
 	db_vals[n_query_cols].val.str_val = subs->event->name;
2006 2006
 	n_query_cols++;
2007 2007
 
2008 2008
 	db_keys[n_query_cols] =&str_status_col;
2009
-	db_vals[n_query_cols].type = DB_INT;
2009
+	db_vals[n_query_cols].type = DB1_INT;
2010 2010
 	db_vals[n_query_cols].nul = 0;
2011 2011
 	db_vals[n_query_cols].val.int_val = subs->status;
2012 2012
 	n_query_cols++;
2013 2013
 								
2014 2014
 	db_keys[n_query_cols] = &str_inserted_time_col;
2015
-	db_vals[n_query_cols].type = DB_INT;
2015
+	db_vals[n_query_cols].type = DB1_INT;
2016 2016
 	db_vals[n_query_cols].nul = 0;
2017 2017
 	db_vals[n_query_cols].val.int_val= (int)time(NULL);
2018 2018
 	n_query_cols++;
... ...
@@ -2020,7 +2020,7 @@ int insert_db_subs_auth(subs_t* subs)
2020 2020
 	if(subs->reason.s && subs->reason.len)
2021 2021
 	{
2022 2022
 		db_keys[n_query_cols] =&str_reason_col;
2023
-		db_vals[n_query_cols].type = DB_STR;
2023
+		db_vals[n_query_cols].type = DB1_STR;
2024 2024
 		db_vals[n_query_cols].nul = 0;
2025 2025
 		db_vals[n_query_cols].val.str_val = subs->reason;
2026 2026
 		n_query_cols++;	
... ...
@@ -38,7 +38,7 @@
38 38
 
39 39
 //#include "presence.h"
40 40
 #include "../../str.h"
41
-#include "../../db/db.h"
41
+#include "../../lib/srdb1/db.h"
42 42
 
43 43
 struct pres_ev;
44 44
 
... ...
@@ -101,10 +101,10 @@ int restore_db_subs(void);
101 101
 
102 102
 typedef int (*handle_expired_func_t)(subs_t* );
103 103
 
104
-void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table,
104
+void update_db_subs(db1_con_t *db,db_func_t dbf, shtable_t hash_table,
105 105
 	int htable_size, int no_lock, handle_expired_func_t handle_expired_func);
106 106
 
107
-typedef void (*update_db_subs_t)(db_con_t * ,db_func_t ,shtable_t ,int ,int ,
107
+typedef void (*update_db_subs_t)(db1_con_t * ,db_func_t ,shtable_t ,int ,int ,
108 108
 		handle_expired_func_t);
109 109
 
110 110
 int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int max_expire,