Collection Object

Philip Mötteli philip.moetteli at econophone.ch
Mon Jul 31 11:17:46 CDT 2006


Am 31.07.2006 um 09:06 schrieb Ruslan Zasukhin:
> On 7/31/06 9:55 AM, "Philip Mötteli"  
> <philip.moetteli at econophone.ch> wrote:
>
>>> In short:
>>>
>>> * Each table have RecID and OID
>>>
>>> * This kind of "Link to many tables" can be made on OID.
>>>
>>> * We have no own kind of link that will support this.
>>>     in draft we have new field type "ObjectsPtr"
>>>     Note "s" at end of "Objects"
>>>
>>>     ObjectsPtr => point OID field of ANY table.
>>>
>>>     ObjectPtr  => point RecID field of some table.
>>>
>>> * So, you can simply make in your CENTRAL TABLE one field of ULLONG
>>> type
>>>     (8 bytes) and store here OID values of tables around.
>>>
>>> * Now how this works.
>>>
>>>     Note that
>>>             OID = (TableID << 32) + RecID
>>>
>>>     If you have OID value you can easy define TableId,
>>>     then get this table by ID and go to RecID of this table.
>>>
>>> Let me know if any questions.
>>
>> Yes  :-), if I understand that right, this is just one pointer to one
>> object? But I have an undefined number of such pointers. Kind of a
>> BLOB of OIDs.
>
> Not right.
>
> 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
> ------------------------------------
>                 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


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


Kind regards
Phil



More information about the Valentina mailing list