[Valentina][VSDK] M:M problems

Eric Forget forgete at cafederic.com
Mon Jan 20 19:30:25 CST 2003


> on 1/21/03 12:31 AM, Eric Forget at forgete at cafederic.com wrote:
> 
>>> I have ask look into SQL.pdf for correct names of functions,
>>> I just do not remember.
>>> 
>>> Okay, I have look inside, and I see that we have made in Valentina
>>>       << and >> operators
>>>   
>>> So at least must be
>>> 
>>>   mGP.SetMethod( "BitAnd(mGroupPtr << 32), mPersonPtr" );
>>> 
>>> And now we need find how correctly do bit AND ...
>>> Ops. I do not see function for this...
>>> Okay I need add them.
>>> 
>>> But it seems you can simply use +
>>> 
>>> 
>>>   mGP.SetMethod( "(mGroupPtr << 32) + mPersonPtr" );
>> 
>> Unfortunately, it still doesn't work. Are you sure it is the class member we
>> put there and not the column name? Sorry if it looks naïve, but I really
>> don't understand how it works...
> 
> Do you work on MAC or Windows ?
> If on MAC, you can take VAPP and play with methods.

I'm on Mac OS X. I've tried to look at it with VAPP and ViSQL.

With VAPP in Developer mode I see the 3 tables, but in Browser mode the
GroupPerson disapear from the popup. It was there before I've added the
virtual field.

With ViSQL I see the 3 tables but not the calculated column...
 
> Eric, we simply try create virtual calculated field
> To be COMPOUND of 2 first.
> 
> Look, let you have f1 and f2 fields in table as ULONG.
> Now you can create f3 with method "f1 + f2"
> 
> So you get 
> 
>   f1          f2          f3
>   ----------------------------
>   1           1           2
>   1           5           6
>   4           9           13
> 
> You see, f3 is not stored on disk, it is calculated on the fly by formula.
> 
> I think problem is that you have ObjectPtr fields.
> I recall that we need wrap them at first my ULONG BaseObject methods.
> 
> So we need simply add 2 more BaseObject methods which are NOT indexed.
> 
> 
> class CGroupPerson : public VDK_BaseObject
> {
> public:
>    VDK_ObjectPtr        mGroupPtr;
>    VDK_ObjectPtr        mPersonPtr;
>   
>   VDK_ULONG             mG;
>   VDK_ULONG             mP;
> 
>    VDK_ULLONG           mGP;
> 
> public:
>   CGroupPerson ()
>        :    VDK_BaseObject( "GroupPerson" ),
>             mGroupPtr( "GroupPtr", NULL, kFBL_CASCADE ),
>             mPersonPtr( "PersonPtr", NULL, kFBL_CASCADE )
>             mG( "mG" ),
>             mP( "mP" ),
>             mGP( "GP", fUnique )
>  {
>        // next call make field to be calculated
>        mG.SetMethod("GroupPtr"); // now mg = GroupPtr, but has type ulong
>        mP.SetMethod("PersonPtr");
> 
>        mGP.SetMethod( "(mg << 32) + mp" ); // case insensitive, btw
>    }
> };
> 
> I have check here, formula on ULONG fields works correctly.

I've still have the same error. Maybe the cast in VDK_ULong doesn't work?

Éric
 

___________________________________________________________________

 Eric Forget                       Cafederic
 ForgetE at cafederic.com             <http://www.cafederic.com/>

 Fingerprint <86D5 38F5 E1FD 5D9C 71C3  BAA3 797E 70A4 6210 C684>




More information about the Valentina mailing list