Design question

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Feb 23 21:08:46 CST 2004


on 2/23/04 8:57 PM, Charles Yeomans at yeomans at desuetude.com wrote:

> I'm in the middle of writing some accounting software, and I have the
> following problem.  I have several types of transactions, each of which
> I are represented by a class inheriting from an abstract class
> Transaction.  Mapping this scheme to a database is straightforward; I
> have a table boTransactions, and a table for each subclass that
> includes a ObjectPtr to boTransactions.  The question I have is this:
> given a boTransactions record, how can it know its base type?  Am I
> going to be forced to add a field to boTransactions?
> 
> Since Valentina is planned with object-relational support in mind,
> perhaps there is a better way.

You need field, Charles.

Small secret.

In Valentina 2.0 we will introduce new

1) OID field. 
    Each table will have this VIRTUAL field, like RecID
    it will have 8 byte size.
    and eat ZERO !!! bytes on disk.
    OID value will be unique in database scope

2) and we introduce its pair

        "ObjectsPtr"
        ^^^^^^^^^^^

Note "s" in the name.
This already 8 byte pointer.
Differ from 4 bytes "ObjectPtr"


Having this you could have in your boTRansaction table
ObjectsPtr pointer, which will points to ONE of SEVERAL tables.


If you look deeply, ObjectsPtr is combination of
        ObjectPtr + ObjectID

I.e. Its in background add one more field.
You see?



---------
Another way for this task -- inheritance of tables.
I have start write it, but not sure I will be in time for 2.0
May be in 2.1 - 2.5



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list