Schema

David Merrill dmerrill@lupercalia.net
Tue, 12 Dec 2000 17:21:23 -0500


On Tue, Dec 12, 2000 at 04:06:48PM -0600, Bill Gribble wrote:
> On Tue, Dec 12, 2000 at 04:53:51PM -0500, David Merrill wrote:
> > iow, what is a "suitable rational representation"?
> 
> A gnc_numeric data structure; 64 bit int for each of numerator and
> denominator.
> 
> > Why "d"amount?
> 
> Figuring that out is archaeology at this point :)

:-)

This is the time to name it more appropriately. Any suggestions on
something a bit more meaningful than 'damount'?

I believe I understand the rationale for using the rational number
notation. It maintains absolute accuracy when dealing with numbers
like 2/3 which would be rounded if stored in a float. But there is no
gnc_numeric data type in a database, so I have to either store it as a
text field as "2/3" or in two integer fields as 2 and 3. Either one
works just fine, but it's easier to ensure data integrity at the
database level by working with two integers. You only have to ensure
there are two non-zero numbers and you have valid data. Testing a
string for validity would be more difficult and I'd have to write my
own routine to do the testing.

> > What is the difference between a cleared balance and a reconciled
> > balance? You typically don't know whether a transaction has cleared
> > until you reconcile. Or, is that changing now that we have such
> > creatures as downloadable updates from your bank?
> 
> Clearing and reconciling are different things.  You need to have
> separate totals.

What is the difference? Cleared means it has cleared the bank, and
reconciled means you have reconciled your account with your statement,
right?

Sorry I'm asking so many questions, but I am not assuming my reading
of the code is correct.

> > Am I correct, then, in visualizing a transaction as essentially a set
> > of splits, within which the sum of debits must equal the sum of
> > credits?
> 
> Yes.  There are also some other fields in the Transaction, and 
> the Account owns the Split rather than the Transaction, but the 
> Transaction has a list of Split *.

In the db, *both* the account and the transaction can own a split. A
split refers to its parent transaction *and* its parent account
(parent in db terms, meaning they have an entity relationship defined
by a foreign key).

-- 
Dr. David C. Merrill                     http://www.lupercalia.net
Linux Documentation Project                dmerrill@lupercalia.net
Collection Editor & Coordinator            http://www.linuxdoc.org
                                       Finger me for my public key

QOTD:
	"It's a cold bowl of chili, when love don't work out."