[SR-Users] sql_xquery() and xavp checks

Alex Balashov abalashov at evaristesys.com
Sat Apr 5 17:41:41 CEST 2014


Hello,

I withdraw this question on grounds of idiocy. My query was returning a 
row when I thought it wasn't.

In actual fact,

    if(!defined $xavp(gateways=>id))

works just fine, because the xavp list is null in that case.

On 04/05/2014 11:32 AM, Alex Balashov wrote:

> Hi,
>
> When using sql_xquery() like this:
>
>     sql_xquery("ca", "SELECT * FROM gateways", "gateways");
>
> ... what's a good way to check if any rows were returned? Since one does
> not have a $dbr(gateways=>rows) value in this scenario, what should one do?
>
> - is_avp_set("$xavp(gateways=>id)")) does not appear to operate on
> XAVPs, or at least, the fixup functions reject them:
>
> ERROR: avpops [avpops.c:935]: fixup_is_avp_set(): bad attribute name
> <$xavp(gateways=>id)>
>
> - the 'defined' operator does not appear to return a negative condition
> here:
>
>     if(!defined $xavp(gateways=>id))
>
> This condition evaluates to true.
>
> Much appreciated!
>
> -- Alex
>


-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list