I have a single pdb on my Palm device and I would like to duplicate it. Do I
have to make a main loop where I make a copy of each record to the new
database or is there any function where I can make a copy of the entire
database in a single step?
I'm trying to do this way:
static void CopyPdbFromAnother(const Char *externName, const Char
*localName, UInt32 type)
{
UInt16 index, numRecords;
MemHandle handle;
MemPtr reg;//,localreg;
UInt16 final=dmMaxRecordIndex;
DmOpenRef externPdb = DmOpenDatabaseByTypeCreator(type, externCreator,
dmModeReadOnly);
DmOpenRef localPdb = OpenEmptyDatabase(localName, appFileCreator, type,
dmModeWrite);
//create new database or clear database
if (externPdb )
numRecords = DmNumRecords(externPdb );
else
return;
if (!localPdb) return;
for (index=0; index<numRecords; index++)
{
handle = DmQueryRecord(externPdb , index);
reg = MemHandleLock(handle);
DmDuplicateRecord(localPdb, &final, reg); // Is there any function like
this?
MemHandleUnlock(handle);
}
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/