[SR-Users] About avp's, var's, null, 0 and empty string

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 16 10:11:18 CEST 2010


  Hello,

On 9/15/10 5:44 PM, Iñaki Baz Castillo wrote:
> 2010/9/15 Juha Heinanen<jh at tutpro.com>:
>> Iñaki Baz Castillo writes:
>>
>>> I retrieve the value of an integer column in a MySQL table. In this
>>> case the value is NULL. I store the result in a $var:
>>>
>>>   $var(client_max_calls) = $dbr(client=>[0,0]);
>>>
>>> But the stored value is "" (empty string) rather than 0. Isn't a bit
>>> confussing?
>> inaki,
>>
>> yes, it is.
>>
>> have you tried what happens if you explicitly convert the rhs value to
>> (int)?

the config does not have the concept of pointers, so $null is pretty 
much particular to each PV class:
- it is like 'not defined' for those PV that can be completely removed 
from the config space. For example, AVPs are are a list of (name, value) 
pairs. When you remove one pair, it is gone from config. You can say 
they are dynamic named variables.
- it is like 'default value' for those PVs that cannot be completely 
removed from config space. For exampe, $var(x) is resolved to a memory 
address structure at startup (for fast access) and cannot be removed 
(otherwise the C pointer will be lost). So assigning $null resets it to 
default, which is integer 0. You can say they are static named variables

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-users mailing list