Collection Object

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jul 31 12:28:55 CDT 2006


On 7/31/06 12:17 PM, "Philip Mötteli" <philip.moetteli at econophone.ch> wrote:

>> Let you have tables
>> 
>> T1 { RecID, OID, a1, a2, ... },   TableID = 1
>> 
>> T2 { RecID, OID, b1, b2, ... },   TableID = 2
>> 
>> T1 { RecID, OID, c1, c2, ... },   TableID = 3
>> 
>> And you need table TC that can point any record of above 3 tables:
>> 
>> TC { RecID, OID, ObjectPtr as ULLONG, ... }
>> 
>> 
>> -----------------------------------------------------
>> First record of T1 has
>> 
>>     RecID = 1,      OID = 0x00000010000001 = 4,294,967,297
>> 2
>> First record of T2 has
>> 
>>     RecID = 1,      OID = 0x00000020000001 = 17,179,869,184
>> 
>> First record of T3 has
>> 
>>     RecID = 1,      OID = 0x00000030000001 = 25,769,803,776
>> 
>> You see?
>>     OID = (TableID << 32) + RecID
>> 
>> 
>> 
>> -----------------------------------------------------
>> Now in TC you can have 3 records:
>> 
>> 
>> TC, TableID = 4 
>> ------------------------------------
>>                 ObjectPtr
>> ------------------------------------
>>                 0x00000010000001
>>                 0x00000020000001
>>                 0x00000030000001
>> ------------------------------------

> So you mean, I have to create an old fashioned intermediate table TC?
> 
> 
> NSSet {RecID, OID}, TableID = 4
> 
> First record of NSSet has
> 
>      RecID = 1,      OID = 0x00000040000001
                            ^^^^^^^^^^^^^^^^^^ where here 4 ???

Look above on my text. TC (has tableID = 4)
And it points to other tables with TablID = 1, 2 and 3.

> TC
> ------------------------------------------------------------------------
>                  ObjectPtr
> ObjectPtr
> ------------------------------------------------------------------------
>                  0x00000040000001                0x00000010000001
>                  0x00000040000001                0x00000020000001
>                  0x00000040000001                0x00000030000001
> ------------------------------------------------------------------------

Again No.

You need simply:

    CREATE TABLE TC ( objects_ptr as ULLONG, ... Other fields ... )

* note, that you self NOT create RecID and OID.
    each Valentina table have them.

    you need ONLY ONE such field to be able point MANY tables.
    here work magic of OID values.

* yes this is not link. So you can name it old-fashion.

* I have not catch you why name it intermediate


-----------------------------------------------------------
* NOTE difference with e.g. MySQL or SqlLite or Oracle.

   -- With Valentina you get benefit of OID values for ZERO !
        zero bytes on disk for these fields in tables T1 T2 T3.
    
   -- in mySQL or Oracle you must self generate this fields in
        tables T1 - T3, you must self generate values for them.
        



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list