Writing is apparently done in ExgDbRead(), as what you intend to do is to
duplicate a (stream) database. I never used ExgDbRead, so just by looking
briefly into the function description (which is not particularly clear) and
into OS sources I would say there is a potential conflict in that the db is
by default copied to itself. It is up to you how you handle it in the
MyDelDBProc.

I can't help you more than you can. Limited Palm OS sources are available
for everybody and they probably contain the answer to your question -
reading them is quite easy.

Regards,
    Jan Slodicka


----- Original Message -----
From: "Bradly J. Barton" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Saturday, June 05, 2004 7:21 PM
Subject: Re: ExgDBRead Trouble


> Right.. it was the first pass at the code (would be cleaned up later)...
> the FileClose is a good catch.
>
> I guess I am confused on what this should do.. why that error? I haven't
> even written the header for the database yet, much less the first
> record. Am I supposed to start at the beginning of the raw db with this
> function or at the first record? I really don't know anything about this
> stream (at runtime... the database is put into this stream format in
> another step) other than I know it is a database.
>
> Jan Slodicka wrote:
>
> >Hello,
> >
> >just some observations to the code:
> >
> >FileClose() call is missing; i.e. you probably open the DB multiple
times.
> >
> >Unnecessary testing FileEOF() in case of no error
> >
> >Unnecessary call to FileTell() - the increment for pFile->curPos is known
> >from the FileRead() call.
> >
> >By looking into Limited Palm OS sources, dmErrNotValidRecord (I hope you
> >meant this error code) is produced only in DmWriteCheck(), which is in
turn
> >called from DmWrite() or DmSet(). Strange thing is that there should be
an
> >alert. (I know, Palm OS 4 sources...)
> >
> >With best regards,
> >    Jan Slodicka
> >
> >
> >----- Original Message -----
> >From: "Bradly J. Barton" <[EMAIL PROTECTED]>
> >To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> >Sent: Saturday, June 05, 2004 1:51 AM
> >Subject: ExgDBRead Trouble
> >
> >
> >
> >
> >>I am having trouble using ExgDBRead... When I make the call (below), the
> >>error that is returned is dmNotValidRecord:
> >>
> >>        sTempFile    file;
> >>        file.fname = fname;
> >>        file.curPos = 0;
> >>        err = ExgDBRead(MyReadDBProc, MyDelDBProc, &file, pDBID, 0,
> >>&needReset, true);
> >>
> >>Here is the callback:
> >>
> >>static Err MyReadDBProc(void *dataP, UInt32 *sizeP, void *userDataP)
> >>{
> >>    Err err = errNone;
> >>    sTempFile    *pFile = (sTempFile*) userDataP;
> >>
> >>    FILE_REF frp = FileOpen(0, pFile->fname, sysFileTFileStream,
> >>dOnlineCreatorID, fileModeReadOnly, &err);
> >>    if (err == errNone)
> >>    {
> >>        err = FileSeek(frp, pFile->curPos, fileOriginBeginning);
> >>        if (err == errNone)
> >>        {
> >>            *sizeP = FileRead(frp, dataP, 1, (Int32) (*sizeP), &err);
> >>            pFile->curPos = FileTell(frp, NULL, NULL);
> >>            if (FileEOF(frp)) err = errNone;
> >>        }
> >>    }
> >>    return err;
> >>}
> >>
> >>I can trace the first pass into the callback, and it appears to read the
> >>first 72 bytes of the stream (looks like the database header in
> >>memory).. and it returns from the callback with no error.
> >>
> >>--
> >>For information on using the Palm Developer Forums, or to unsubscribe,
> >>
> >>
> >please see http://www.palmos.com/dev/support/forums/
> >
> >
> >
> >
>
> --
> Bradly J. Barton - [EMAIL PROTECTED]
> Jenies Technologies Incorporated
> (972) 602-1835
> http://www.JTI.net
> http://HandAble.com
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to