Hierarchical database setup revisited

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Nov 9 10:11:34 CST 2003


on 11/9/03 2:34 AM, Arthur Clemens at aclemens at xs4all.nl wrote:

> I encounter a bug in my code where Valentina crashes. It happens when I
> create a new record for boTranslation (see below) and pass the parent's
> RecID. Now I wonder, is it possible to have parent pointers 2 levels
> deep?
> 
> I have this preliminary setup:
> 
> class boRecord
> 
> class boSloveneWord
>    VDK_ObjectPtr   mfParentPtr; // pointer to boRecord
> 
> class boRecordSection
>    VDK_ObjectPtr   mfParentPtr; // pointer to boRecord
> 
> class boTranslation
>    VDK_ObjectPtr   mfParentPtr; // pointer to boRecordSection
> 
> 
> When I add a new record to table boSloveneWord, and pass the FBL_REC_ID
> of the parent's Record to it, all is fine:
> 
> inline void boSloveneWord::addRecord(const FBL_REC_ID& inParentID) {
>    this->SetBlank(); // Clear memory buffer of the BaseObject
>    mfParentPtr = inParentID; // no problem
>    VDK_BaseObject::AddRecord();
>    Flush(); // from cache to disk
> }
> 
> But when I do the same: add a record to table boTranslation, and pass
> the FBL_REC_ID of the parent's boRecordSection to it, it crashes: (the
> code is the same)
> 
> inline void boTranslation::addRecord(const FBL_REC_ID& inParentID) {
>    this->SetBlank(); // Clear memory buffer of the BaseObject
>    mfParentPtr = inParentID; // crash here
>    VDK_BaseObject::AddRecord();
>    Flush(); // from cache to disk
> }
> 
> Could it be that Valentina has a problem that I want to assign a parent
> pointer that points to boRecordSection, that itself has a pointer to
> boRecord?

Of course no!

1) Arthur, check that you send correct RecID in the second case.
This is OTHER value, correct?

2) may be table itself is corrupted? Try on fresh db with ZERO records in
all  tables. Then you will know that must come RecID 1


3) you can do this->Flush() to check only cache blocks for this table.
This will be little faster.




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