Method syntax for a composite pointer index

chuck hinkle chuckbo at hinkles.us
Sun Nov 2 23:16:23 CST 2003


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


I've been trying to implement this code this evening but have not been able
to figure it out. (I'm really not trying to avoid the documentation; if you
want to point me to a particular section or page, that's fine.)


In my baseobject's constructor, I have this code.

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

I also added a property fldComposite as vULLong to the baseobject's
properties. But when I try to run the the program, this line gives me the
error:


"New operator has incorrect number of parameters for constructor, or the
parameters might be in the wrong order"


I get the same error if I leave out the kV_Indexed + kv_Unique flag. I get
the same error if I move the method description behind the flags.





I'm looking at pp 32-33 in the Valentina kernel documentation and don't see
anything helpful.
Page 27 in the REALbasic reference talks about creating Baseobject methods,
but it is using the CreateField command. Do I need to be using CreateField
instead of putting the code into the table class' constructor method? Then,
I look at page 4 of the Valentina SQL documentation, and the only thing I
see about building tables is with the CREATE TABLE command. I've relied, so
far, heavily on the REALbasic Tutorial documentation; it recommends using
the class constructors, which I've done, but it doesn't include any examples
with Methods that I see. Is there anything that I need to add to indicate to
valentina that this is a method? I'm also looking at P. 37 in the  REALbasic
reference that says that all of the Vfield takes 2 parameters, the name of
the column and the flags.
I also tried breaking the field into several lines like this:
  fldComposite = new vULLong("fldComposite")
  fldComposite.isMethod = true
  fldcomposite.setMethod = "(Component_ptr << 16) + Container_ptr"
  fldComposite.indexed = True
  fldComposite.Unique = True

but the .isMethod line gave me the error:
    "The instance variable cannot be modified at runtime."



So I feel like I'm going from document to document, and I keep getting more
and more confused, and I'm not experienced enough to figure out what to try
next.

chuck 




More information about the Valentina mailing list