Method syntax for a composite pointer index

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Nov 1 09:39:07 CST 2003


on 11/1/03 6:36, chuck hinkle at chuckbo at hinkles.us wrote:

> 
> I have a table which is used to resolve a many-to-many relationship between
> two other tables. I create it with
> 
> 
> '     Define the fields/properties of the table
> 
> name = "Container_components"
> 
> Component_ptr = new vobjectPtr("Component_ptr", indatabase.Components,
> kv_cascade + kv_indexed)
> Container_ptr = new
> vobjectPtr("Container_ptr",indatabase.containers,kv_cascade + kv_indexed)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                BTW, this is NOT CORRECT!!!!


Cascade -- this is deletion control parameter.

kV_Indexed -- this is FLAGS parameter.

Please check docs!


> But I want these records to be unique, so I need to have a composite index
> that I can make unique. I've never written an SQL method, though; I don't
> know where to put it (in my RB code), and I sure don't know know how to join
> two pointers and to make their result unique.  I've spent an hour and a half
> going through the Valentina manuals looking for examples, but it's probably
> that I just don't know where to look.
> 
> I'd appreciate any code that can be shared.

BaseObject method -- this is just another field.

You have 2 ULONG numbers.
You want get their composition -- so this should be ULLONG number.

Formula is: 
    a) do bit shift to left on 16 of first number
    b) add second number

 fldComposite = new vULLong( "Composite",
                             "(Component_ptr << 16) + Container_ptr",
                             kV_Indexed + kv_Unique )

I think this should work.

It will be easy at first check in VAPP.


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