// 1) and 2) (make a new chunk with the correct size)
recordH = DmNewHandle(dbP, (Int32) PrvAddrDBUnpackedSize(r));
if (recordH == NULL)
return dmErrMemError;
// 3) Copy the data from the unpacked record to the packed one.
recordP = (PrvAddrPackedDBRecord*) MemHandleLock(recordH);
PrvAddrDBPack(r, recordP);
// Get the index
newIndex = PrvAddrDBFindSortPosition(dbP, recordP);
MemPtrUnlock(recordP);
// 4) attach in place
err = DmAttachRecord(dbP, &newIndex, recordH, 0);
if (err)
MemHandleFree(recordH);
else
*index = newIndex;