I have a question about using DmWrite and other Database funcions.

Up to now I have saved my data in fixed length structures.  That works
ok but there is a lot of wasted space.  I would now like to save my data
in variable length records.  I am using a function like below.  

I'm wondering if the DmWrite function will automatically reallocate memory if the 
size of the data being written varies (specifically increases).  That is, if the first 
time a record is written it takes up, say 50 bytes, and then later when I Update that 
same record, but it now takes 75 bytes, will that record overwrite the following 
record?  

Does DmWrite and other Dm functions take care of reallocation and sizing of 
memory?

Which functions are safe to use with variable length data and which are not?

void UpdateRec()
{
    VoidHand   RecHandle;
    Ptr         RecPointer;
    int         i;
        
    RecHandle = DmGetRecord(DB, curIdx);
    RecPointer = MemHandleLock(RecHandle);
    DmWrite(RecPointer, 0, &val, sizeof(val));
    DmWrite(RecPointer, 2, &name, sizeof(name));
    for(i=0; i<val; i++) {
        DmWrite(RecPointer, i*32 + 25, &Array[i], sizeof(Array[i]));
    }
    MemPtrUnlock(RecPointer);
    DmReleaseRecord(DB, curIdx, true);
}
--
-----------------------------------------------------------------
Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/

Protect your constitutional rights. Your favorite one may be next!
-----------------------------------------------------------------

Reply via email to