[sr-dev] storing DOUBLE in mysql

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 10 21:36:05 CET 2010



On 2/10/10 8:50 PM, Aymeric Moizard wrote:
>>> I'm using kamailio release 3.0 (from git branch3 of sip router)
>>> and I'm trying to store a double value in my mysql database:
>>>
>>> I discovered that existing code only allow 2 decimal digit precision
>>> in file "db_ut.c":
>>>
>>> ret = snprintf(_s, *_l, "%-10.2f", _v);
>>>
>>> I don't clearly understand the reason,
>>
>> the pseudo-variables have support only for integer or string values
>> (no doubles in cfg operations).
>
> I'm using double in modules I'm working on.
>
>> Double is used internally only for contact q value, and I guess that
>> has 2 digits precision. It is fine for me to increase the precision.
>> I cannot think now of any drawback.
>
> I tried to compile with 7 digit and it's working fine for my module.
> However, I haven't tested anything else.

I did a grep and the only module using double via db api is usrloc (the 
others are db drivers). So it is easy to check and test.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
eLearning class for Kamailio 3.0.0
* http://www.asipto.com/




More information about the sr-dev mailing list