Some motive to gnucash mysql database fields are created on varchar structure?

Wm... tcnw81 at tarrcity.demon.co.uk
Fri Nov 6 17:23:32 EST 2015


Wed, 4 Nov 2015 06:45:14 
<06F6442F-3F71-4AB6-8FE7-835A881CD17B at ceridwen.us>
John Ralls <jralls at ceridwen.us> wrote...

>
>> On Nov 3, 2015, at 11:49 AM, Elvis de Freitas <edigitalb at gmail.com> 
>wrote:
>>
>> I am analyzing gnucash database and I see that at least some 
>financial
>> fields are on text format. Why gnucash use that architecture? And Why 
>it is
>> interesting?  I see too that the decimal values are saved as integer
>> like(or raw value), for example, 12.50 is saved as 1250 on database.
>>
> Can someone explain it? I really stayed interested with it
>
> Thank you very much

Numbers are rationals, with two fields for numerator and denominator. 
This was an early decision and we confirmed its wisdom with some 
extensive testing in 2014. That showed that the alternative, BCD, is 4-6 
times slower than rational for our unit tests. As I’m sure you know, 
floating point is not acceptable for financial use because it’s not 
able to exactly represent many decimal fractions.

As for the other fields, GnuCash was designed around the XML file 
format. SQL is an afterthought bolted on for the 2.4 series. While 
we’re engaged in rewriting GnuCash to be SQL-centered we’ll likely 
keep the current schema for backwards compatibility.


===

The OP may also find it useful to know that GnuCash is agnostic about 
SQL backend and GnuCash + SQL will probably make more sense if viewed 
from an SQLite POV rather than either mysql or postgres specifically

-- 
Wm...



More information about the gnucash-user mailing list