2010/10/15 Daniel-Constantin Mierla <mico...@gmail.com>:
>> Usually I get data from a DB table in which some fields are INT
>> (allowing NULL). Possible values are NULL or integers from 0 to N.
>> Trying to figure if the column has value 0 is a pain.
>
> Have you tried: if($var(x)==0) ?

Yes, that would work, but it's not what I need:

I retrieve a table column value via a DB query and store it in an AVP.
Such column can store NULL, 0, 1, 2 ... 8.
How can I check if the AVP has an integer value (including 0)?:


1) In case I retrieve 1...8 from the database:

  - if $avp(column)            => true
  - if $avp(column) >=0     => true

2) In case I retrieve 0 or NULL from the database:

  - if $avp(column)            => false
  - if $avp(column) >=0     => ERROR (invalid comparison)


So there is no way to determine if the retrieved value is *any*
integer (including 0), is there?


PS: I *strongly* hate the fact that 0 is threated as "false" or "non true", why?


Regards.



-- 
Iñaki Baz Castillo
<i...@aliax.net>

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to