Re: evaluating unlang IF with sql results

2013-06-14 Thread Bill Schoolfield

Actually this particular issue was the parenthesis around the number. I had 
added
them in the expression to make sure the math occurred before the logical 
comparison.

Without them though, unlang's IF seems to evaluate the first expression (a 
subtraction)
and ignores things afterwards. So the IF always evaluated to true.

I've concluded that the use of IF with multiple expressions won't work. So I 
have move
this logic to perl.

Bill

On 6/13/2013 6:55 PM, Alan DeKok wrote:

Bill Schoolfield wrote:

The above code fails with a message (below) that says (Right field is
not a number at: (1371158700)). I tried adding
a zero to force a number interpretation but this does nothing.


   That error is produced by the SQL database, not by FreeRADIUS.

   My guess is that the error is because the number is larger than 2^32.

   Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: evaluating unlang IF with sql results

2013-06-14 Thread Alan DeKok
Bill Schoolfield wrote:
 Actually this particular issue was the parenthesis around the number. I
 had added
 them in the expression to make sure the math occurred before the logical
 comparison.

  The man unlang documentation describes the syntax it expects.
Adding a random paranthesis won't work.

 Without them though, unlang's IF seems to evaluate the first expression
 (a subtraction)
 and ignores things afterwards.

  The first expression is an expansion, via %{expr:...}.  It *does* work.

 So the IF always evaluated to true.
 
 I've concluded that the use of IF with multiple expressions won't work.

  Well, no.  It does work.

  If you use git master branch, it produces much better error
messages.  They were added for precisely these reasons.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: evaluating unlang IF with sql results

2013-06-13 Thread Alan DeKok
Bill Schoolfield wrote:
 The above code fails with a message (below) that says (Right field is
 not a number at: (1371158700)). I tried adding
 a zero to force a number interpretation but this does nothing.

  That error is produced by the SQL database, not by FreeRADIUS.

  My guess is that the error is because the number is larger than 2^32.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html