[sr-dev] git:master: modules_k/htable: Correctly save the value type in the database .

Alex Hermann alex at speakup.nl
Mon Aug 8 10:51:03 CEST 2011


Module: sip-router
Branch: master
Commit: 1a15c075076b5df815749bc28961bc088108f852
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a15c075076b5df815749bc28961bc088108f852

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date:   Thu Jul 28 12:42:50 2011 +0200

modules_k/htable: Correctly save the value type in the database.

Instead of always saving '0' (string), write a '1' (int) if value is integer.

---

 modules_k/htable/ht_db.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules_k/htable/ht_db.c b/modules_k/htable/ht_db.c
index 66402fe..c50021b 100644
--- a/modules_k/htable/ht_db.c
+++ b/modules_k/htable/ht_db.c
@@ -340,14 +340,15 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
 
 			db_vals[2].type = DB1_INT;
 			db_vals[2].nul = 0;
-			db_vals[2].val.int_val = 0;
 
 			db_vals[3].type = DB1_STR;
 			db_vals[3].nul  = 0;
 			if(it->flags&AVP_VAL_STR) {
+				db_vals[2].val.int_val = 0;
 				db_vals[3].val.str_val.s   = it->value.s.s;
 				db_vals[3].val.str_val.len = it->value.s.len;
 			} else {
+				db_vals[2].val.int_val = 1;
 				tmp.s = sint2str((long)it->value.n, &tmp.len);
 				db_vals[3].val.str_val.s   = tmp.s;
 				db_vals[3].val.str_val.len = tmp.len;




More information about the sr-dev mailing list