[SR-Users] "select count(*)" with avp_db_query always returns null

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 5 12:21:05 CEST 2011


Hello,

On 7/5/11 12:07 PM, Andrade Ricardo (CI/AFU1) wrote:
> Hi Daniel,
> Hi Alex,
>
> Thanks! That looks great. Once commited, I'll test it, too.
>
> By the way, I've just tried with sql_query. It didn't work as well. Do you think it is fixed together with Alex's change?
>
> Shouldn't there be a warning/error message if the returned data type is not supported?
>
>
> Code:
>          sql_query("openserdb", "SELECT count(*) FROM subscriber where username='foo'", "ra");
>          $avp(s:value) = $dbr(ra=>[0,0]);
>          xlog("L_INFO", "avp(s:value)=$avp(s:value)\n");
>            sql_result_free("ra");
>
> Output:
>            avp(s:value)=
interesting, I just looked in the code and bigints should be converted 
to string values. Can you test if ($dbr(ra=>rows) >0) to be sure there 
was a row returned by the query.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list