Having stupid trouble with dmGetrecord using the "PalmOS 3.5-en-ezdbg.rom"
using codewarrior R6 + patch and ugrades.
This is the code...
MemHandle FishGetFish ( UInt16 uIndex )
{
Err err;
s_recordNum = 0;
if (s_dbFish)
{
err = DmSeekRecordInCategory ( s_dbFish, &s_recordNum, uIndex,
dmSeekForward, s_wCurrentCategory);
// Get the record
s_hRec = (MemHandle) DmGetRecord ( s_dbFish, s_recordNum);
if (s_hRec)
{
// Lock it down and get a ptr
s_pFish = (FishRecord *) MemHandleLock (s_hRec);
// s_pText is a global
}
}
return s_hRec;
}
/***************************************************************************
***
* FishReleaseFish:
* Parms: none
* Return: none
****************************************************************************
**/
void FishReleaseFish ()
{
// unlock record
if (s_hRec)
MemHandleUnlock (s_hRec);
}
// Release the record, not dirty , i.e. it uses the DB functions.
DmReleaseRecord ( s_dbFish, s_recordNum, false );
// Reset the current record number
s_recordNum = 0;
return;
}
Both these functions are called so i dont think its a problem leaving the
record locked or not releasing the record.
The thing is it seems to work the first time i add a record but the second
time it causes an ..."Err getting rec"...
I though it might be to do with forgetting to unlock or release a record but
i cant see anywhere that it doens't do this. It also seems to be something
that the none debug version accepts as not being a problem. However i for
one believe the debug version and want to avoid future problems.
Im using categories so could it be something to do with this? the
DmSeekRecordInCategory function doesn't seem to have a problem.
utterly confused. Help!!!
--
Emile Swain
* * * * * * * * * * * *
Creative Developer
www.AKQA.com
* * * * * ** * * * * * *
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/