[OpenSIPS-Users] avp_db_query empty string results in NULL [BUG?]

Podrigal, Aron aronp at guaranteedplus.com
Tue Oct 13 22:50:28 CEST 2015


Is this really what we want?
perhaps something like this would make more sense

diff --git a/modules/avpops/avpops_db.c
b/modules/avpops/avpops_db.cindex 78acee3..79ea087 100644---
a/modules/avpops/avpops_db.c+++ b/modules/avpops/avpops_db.c@@ -502,7
+502,7 @@ int db_query_avp_print_results(struct sip_msg *msg, const
db_res_t *db_res,
                                        avp_val.s.s=

(char*)RES_ROWS(db_res)[i].values[j].val.string_val;

avp_val.s.len=strlen(avp_val.s.s);-
   if(avp_val.s.len<=0)+
if(avp_val.s.len<0)
                                                goto next_avp;
                                break;
                                case DB_STR:@@ -511,7 +511,7 @@ int
db_query_avp_print_results(struct sip_msg *msg, const db_res_t
*db_res,

RES_ROWS(db_res)[i].values[j].val.str_val.len;
                                        avp_val.s.s=

(char*)RES_ROWS(db_res)[i].values[j].val.str_val.s;-
                    if(avp_val.s.len<=0)+
         if(avp_val.s.len<0)
                                                goto next_avp;
                                break;
                                case DB_BLOB:@@ -520,7 +520,7 @@ int
db_query_avp_print_results(struct sip_msg *msg, const db_res_t
*db_res,

RES_ROWS(db_res)[i].values[j].val.blob_val.len;
                                        avp_val.s.s=

(char*)RES_ROWS(db_res)[i].values[j].val.blob_val.s;-
                     if(avp_val.s.len<=0)+
          if(avp_val.s.len<0)
                                                goto next_avp;
                                break;
                                case DB_INT:


On Tue, Oct 13, 2015 at 4:10 PM, Podrigal, Aron <aronp at guaranteedplus.com>
wrote:

> Hi there,
>
> I noticed some unexpected behavior with avp_db_query which is, if a
> varchar column has a empty string the avp value will be NULL.
>
> Has anyone experienced such behavior or a workaround.
> I use db_mysql driver.
>
>
> Regards
>
> --
> Aron Podrigal
> -
> '1000001', '1110010', '1101111', '1101110'   '1010000', '1101111',
> '1100100', '1110010', '1101001', '1100111', '1100001', '1101100'
>
> P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39'
>
>


-- 
Aron Podrigal
-
'1000001', '1110010', '1101111', '1101110'   '1010000', '1101111',
'1100100', '1110010', '1101001', '1100111', '1100001', '1101100'

P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20151013/abef4a75/attachment.htm>


More information about the Users mailing list