Hierarchical database setup revisited

Arthur Clemens aclemens at xs4all.nl
Sun Nov 9 01:34:02 CST 2003


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?

Arthur Clemens




More information about the Valentina mailing list