[SR-Users] time for acc records

Alex Hermann alex at speakup.nl
Thu Aug 11 15:06:40 CEST 2011


On Thursday 11 August 2011, Henning Westerholt wrote:
> On Thursday 11 August 2011, Alex Hermann wrote:
> > On Wednesday 10 August 2011 14:21:10 Daniel-Constantin Mierla wrote:
> > > - a new column to store the seconds.milliseconds as double
> > 
> > Please don't use double, use a fixed point format. Double's are for
> > scientific use, this is accounting so exact numbers are required.
> > 
> > In MySQL, one could use the DECIMAL type.
> 
> there is currently no write functionality in the DB API and also scheme
> generation XSL to support the DECIMAL type.
IMHO support should be added then. Floating point (on digitial equipment) is 
not suitable nor acceptable (it might even be illegal in some jurisdictions) 
for accounting.

I really wonder why DOUBLE support is(/would be) present in a SIP proxy.

> If double is not correct for
> you, what about just storing the milliseconds as INT value e.g. 12,3s =>
> 123 in the DB?
Why try to invent a workaround? Fixed point number types are part of SQL92:  
NUMERIC(precision, scale).


> BTW, only db_mysql and db_unixodbc currently support DECIMAL value for
> read, db_mysql evaluates it to DB1_STRING, db_unixodbc to DB1_INT.
I know. You committed the fix for MySQL yourself after my bugreport, see 
commit b74e6f6.

Internal representation as string is ok as long as calculations are not 
necessary. Alternatively a scaled integer could be used internally.

-- 
Greetings,

Alex Hermann




More information about the sr-users mailing list