[Valentina][VSDK] M:M problems

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jan 20 19:03:41 CST 2003


on 1/20/03 6:52 PM, Eric Forget at forgete at cafederic.com wrote:

>> 5) It seems you try to check that table mGroupPerson do not have such pair
>> before do add. But then you can do this in the more simple way.
>> 
>> Create BaseObject method -- virtual field in table mGroupPerson, that is
>> join of both fields and make unique index for it. Now in above my function,
>> AddRecord() will throw exception in case such pair exists. You may need add
>> try-catch block to cacth it.
>> 
>> Very simple and much more effective. Payment for this -- third index on
>> table mGroupPerson on disk. Actually it is possible to do 2 searches on
>> fields mGroups and mPerson, get 2 BitSet from searches, and do
>> Intersection() to get result.
>> 
>> Even hard to say what is faster. Because both ways affect speed of Add().
>> First way with require additional time on adding of pair<> to index,
>> But it is faster on search of index (because one search on index is faster
>> of 2 searches on 2 indexes). But first way with third index, require less
>> work from you, and in fact it put more work on database, and I think this is
>> good, when logic is stored in db instead of your code.
> 
> This seems to be a good idea. However, how do I create a such a virtual
> field this is a join? I search in the doc but found nothing...

You need look into SQL.pdf for list of functions that can be used by
Methods.


class CGroupPerson : public VDK_BaseObject
{
    public:
        VDK_ObjectPtr        mGroupPtr;
        VDK_ObjectPtr        mPersonPtr;
        VDK_ULLONG           mGP;

    public:
       CGroupPerson ()
            :    VDK_BaseObject( "GroupPerson" ),
                 mGroup( "Group", NULL, kFBL_CASCADE ),
                 mPerson( "Person", NULL, kFBL_CASCADE )
                 mGP( "GP" )
        {
            // next call make field to be calculated
            mGP.SetMethod( "some formula here" );
        }
};


In ideal it seems we can use 8 bytes to join 2 RECID...
This is easy do using string operations...

Ops, it seems for now way only string operations...
We need add bit functions yet.

Please check if we have right now bit functions...
If yes then 

            mGP.SetMethod( "BitAnd( shiftleft(mGroup,32), mPerson" );


-- 
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://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list