Collection Object

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


Sorry, there was an oversight: The NSSet table should have an ID of  
5! I recreated my post:


Am 31.07.2006 um 11:28 schrieb Ruslan Zasukhin:

> 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,2972

>>> 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?  
With intermediate, I mean a table, that only serves to create an M:M  
relation.


NSSet {RecID, OID}, TableID = 5

First record of NSSet has

      RecID = 1,      OID = 0x00000050000001


TC
------------------------------------------------------------------------
                  ObjectPtr                                    ObjectPtr
------------------------------------------------------------------------
                  0x00000050000001                0x00000010000001
                  0x00000050000001                0x00000020000001
                  0x00000050000001                0x00000030000001
------------------------------------------------------------------------


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

With TC you mean "Table Central"? Which should actually be my NSSet  
table?


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

I got that.


>     you need ONLY ONE such field to be able point MANY tables.

What I need is pointing to many records in many tables at the same  
time. If following this ObjectsPtr actually means, returning several  
records, not just one, then I finally got it.


But then, this is misleading me:

> I_Table_Ptr GoTo( I_Database_Ptr inDb, OID inOID )

This should actually return a bunch of I_Table_Ptr's.


Phil



More information about the Valentina mailing list