Re: [SR-Users] sql_xquery() and xavp checks

2014-04-08 Thread Alex Balashov
On 04/08/2014 03:45 AM, Alex Hermann wrote: 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 Ah, right! I forgot to check the undocum

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-08 Thread Alex Hermann
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

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-07 Thread Alex Balashov
On 04/07/2014 08:57 AM, Fred Posner wrote: Have you tried something like... if (sql_xquery("ca", "SELECT * FROM gateways", "gateways") == 1) { #do stuff } else { #dang nabbit } I haven't, but I've been satisfied with this as a solution: sql_xquery("ca", "SELECT * FROM gateways",

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-07 Thread Fred Posner
Have you tried something like... if (sql_xquery("ca", "SELECT * FROM gateways", "gateways") == 1) { #do stuff } else { #dang nabbit } Fred Posner The Palner Group, Inc. 503-914-0999 (direct) 954-472-2896 (fax) On 04/06/2014 02:37 PM, Alex Balashov wrote: On 04/06/2014 12:37 AM,

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-06 Thread Alex Balashov
On 04/06/2014 12:37 AM, Kelvin Chua wrote: $dbr for SELECTs Unless it's not, because you're using sql_xquery(). :-) -- 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:

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Kelvin Chua
no, it's not for SELECT. $dbr for SELECTs Kelvin Chua On Sat, Apr 5, 2014 at 6:16 PM, Fred Posner wrote: > On 04/05/2014 09:01 PM, Alex Balashov wrote: > >> Does that work for SELECT queries? The documentation says it's only for >> INSERT, UPDATE and DELETE. >> >> >> > It did not during my tes

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Fred Posner
On 04/05/2014 09:01 PM, Alex Balashov wrote: Does that work for SELECT queries? The documentation says it's only for INSERT, UPDATE and DELETE. It did not during my test this afternoon. --fred On 6 April 2014 02:14:24 CEST, Kelvin Chua wrote: dunno if this helps but i use $sqlrows(ca

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Alex Balashov
Does that work for SELECT queries? The documentation says it's only for INSERT, UPDATE and DELETE. On 6 April 2014 02:14:24 CEST, Kelvin Chua wrote: >dunno if this helps but i use $sqlrows(ca) to check whether there are >rows >returned > >Kelvin Chua > > >On Sat, Apr 5, 2014 at 9:15 AM, Alex B

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Kelvin Chua
dunno if this helps but i use $sqlrows(ca) to check whether there are rows returned Kelvin Chua On Sat, Apr 5, 2014 at 9:15 AM, Alex Balashov wrote: > On 04/05/2014 12:14 PM, Fred Posner wrote: > >> > I don't think so. As I understood the documentation, at least, $dbr >> > doesn't get populat

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Alex Balashov
On 04/05/2014 12:14 PM, Fred Posner wrote: > I don't think so. As I understood the documentation, at least, $dbr > doesn't get populated in this case; the rows just go straight to an > xavp list. I suppose I should verify that. > Looks like you're right. Tested various methods. This does

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Fred Posner
> I don't think so. As I understood the documentation, at least, $dbr > doesn't get populated in this case; the rows just go straight to an > xavp list. I suppose I should verify that. > Looks like you're right. Tested various methods. Fred Posner The Palner Group, Inc. 503-914-0999 (direct) 95

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Alex Balashov
On 04/05/2014 11:42 AM, Fred Posner wrote: When I use xquery, I generally use it with a stored procedure that returns a value if not matched... so I always return at least one row with a variable of 'fail', -1, etc. to evaluate. I actually do that too in many cases, but only because I often ne

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Fred Posner
When I use xquery, I generally use it with a stored procedure that returns a value if not matched... so I always return at least one row with a variable of 'fail', -1, etc. to evaluate. I like this for a variety of reasons (ie changing sql without changing the config)... but that being said...

Re: [SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Alex Balashov
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_xq

[SR-Users] sql_xquery() and xavp checks

2014-04-05 Thread Alex Balashov
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