[SR-Users] how can string "0" be equal to int 0?

Iñaki Baz Castillo ibc at aliax.net
Fri Oct 15 22:22:00 CEST 2010


2010/10/15 Iñaki Baz Castillo <ibc at aliax.net>:
> 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?


A terrible hack:

   if $(avp(column){s.len}) > 0 && ...

This is, in case the valus is an integer (including 0) its string
legth is greater than 0. But this is a non ellegant workaround.




-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-users mailing list