[SR-Users] sql_xquery() and xavp checks

Alex Hermann alex at speakup.nl
Tue Apr 8 09:45:25 CEST 2014


On Saturday 05 April 2014 17:32:18 Alex Balashov wrote:
> 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?

All sqlops query functions have (undocumented) return values:

-1: error in parameters or query execution
1: query successful, at least one row in resultset (for SELECTs)
2: query successful, no rows returned

It might be useful to extend $sqlrows() to return the number of rows in the 
resultset.

-- 
Alex Hermann



More information about the sr-users mailing list