SQL backend for GnuCash 2

Derek Atkins warlord at MIT.EDU
Thu Oct 26 10:09:18 EDT 2006


"Daniel Espinosa" <esodan at gmail.com> writes:

> 2006/10/25, Josh Sled <jsled at asynchronous.org>:
>> On Wed, 2006-10-25 at 14:52 -0500, Daniel Espinosa wrote:
>> > Let me study this items, but at first, I could say that the way
>> > GnuCash handles the numeric values and representation, could be out
>> > the scope of the schema becouse it will show how the values are stored
>> > in the database and how they are related with others.
>>
>> Well, to some degree ... e.g., we shouldn't try to pack a gnc_numeric
>> structure into a blob or anything.  But we shouldn't try to get around
>> representing a gnc_numeric, either.  Speaking of which...
>>
>> Values in GnuCash are generally represented as a rational value,
>> represented by a numerator and denominator, each a 64bit integer.  This
>> GncNumeric is coupled with a specific commodity, usually implicitly,
>> from the Account of the Split that the GncNumeric value is part of.
>> That makes them able to store both currency (123.45 USD) as well as
>> stocks and mutual funds (7.429 shares of fund XYZ).  There's a bit more
>> detail than that, but that's the core part.

It looks like the PG Backend just stored the gnc_numeric Numerator, on
the theory that the denominator was already known based on the Account
and Commodity.  At least this is what I see in src/backend/postgres/table.m4

I'm not sure if that's the "right" approach...

[snip]
> Of course the efort must be to have working GnuCash database backend,
> the other is just an idea turning my mind, but nothing to worry about.
> Go to make this to work.

Good to hear.  :)

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list