incomplete understanding of kFBL_CASCADE (or FBL_DeletionControl)

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Oct 25 02:44:19 CDT 2003


on 10/25/03 0:49, Arthur Clemens at aclemens at xs4all.nl wrote:

Hi Arthur,

> I am trying to set up a new database for a dictionary.
> My new database setup has a hierarchical setup. I have a Record, that
> 'holds' the table RecordSection (more sections per record possible),
> and that holds in part 'Word', 'Translation', and so on.
> If I delete an entry in the Record table, child entries in
> RecordSection should get deleted too (and eventually Word, Translation,
> but I haven't got that far yet). I can't get it to work, and the code
> examples are sparse.
> 
> First, should kFBL_CASCADE work with MacOS X (VSDK Framework)?

Yes of course.

> If so, I am doing something not right.
> 
> Let me show the code, maybe someone can point me out where I am wrong.
> For simplicity I am having all code in header files.
> 
> // ----------------------------------------------------------
> // Record table class
> // ----------------------------------------------------------
> 
> class boRecord : public VDK_BaseObject
> {
> public:
>    VDK_Date        mfCreationDate;
>    VDK_Date        mfModificationDate;
> public:
>    boRecord() :
>    VDK_BaseObject( "Record" ),
>    mfCreationDate( "Creation date" ),
>    mfModificationDate( "Modification date" )
>    { }
>    FBL_EXP virtual FBL_REC_ID AddRecord() {
>        this->SetBlank(); // Clear memory buffer of the BaseObject
>        // ... some things like setting creation date
>        VDK_BaseObject::AddRecord();
>        Flush(); // from cache to disk
>    }
> };
> 
> // ----------------------------------------------------------
> // RecordSection table class
> // ----------------------------------------------------------
> 
> class boRecordSection : public VDK_BaseObject
> {
> public:
>    VDK_ObjectPtr mfParentPtr; // pointer to boRecord
> 
> public:
>    boRecordSection(FBL_REC_ID inRecordId) :
>        VDK_BaseObject( "Record section" ),
>        mfParentPtr( "Parent", inRecordId, kFBL_CASCADE )
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ wrong
            see correct text below.
>    { }

>    void AddRecord(FBL_REC_ID inParentID) {
>        this->SetBlank(); // Clear memory buffer of the BaseObject

>        // doesn't work, crashes: // mfParentPtr = new VDK_ObjectPtr(
> "RecordPtr", inParentID, kFBL_CASCADE );
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ of course this is wrong


>        mfParentPtr = inParentID;
>        // ... some things like filling Grammar fields (Grammar will be
> a child of boRecordSection)
>        VDK_BaseObject::AddRecord();
>        Flush(); // from cache to disk
>    }
> };



class boRecordSection : public VDK_BaseObject
{
public:
     VDK_ObjectPtr mfParentPtr; // pointer to boRecord

public:

     boRecordSection( boRecord* inRecord )
    :
         VDK_BaseObject( "Record section" )
    ,     
         mfParentPtr( "Parent", inRecord, kFBL_CASCADE )
    { 
    }


The second parameter of ObjectPtr must be POINTER on BaseObject.

I even wonder how you was able compile with FBL_REC_ID here!?


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