On Fri, Jul 07, 2000 at 10:30:43AM -0700, Danny Epstein wrote:

> > 2. The database can determine the length only from the header
> > information (which the documentation in the devzone says).
> 
> I'm not sure what you're getting at here. The last record or resource in a
> .prc or .pdb file extends to the end of the file. If you take a valid .prc
> or .pdb file and stick an extra byte on the end, the result will be a .prc
> or .pdb file in which the last record or resource has an extra byte.

If you read the description of ExgDBRead, it says that it knows when
the file ends by information in the header (I have the exact section
in an earlier message, but read the 3.5 reference).

To quote the reference manual:

  The read callback function should return an error number, or 0 if
  there is no error. If the callback function returns an error,
  ExgDBRead deletes the database it was creating, cleans up any
  memory it allocated, then exits, returning the error passed back
  from the callback function.

  The read callback function is called multiple times by ExgDBRead.
  Each time, it passes in sizeP the number of bytes it expects to re-
  ceive in the next chunk you are to return in dataP. In sizeP, it's im-
  portant to set the number of bytes that you actually place in dataP,
  if it's not the same as what ExgDBRead expected. ExgDBRead stops
  calling the read callback function after it receives the entire database
  (it knows when it's got it all based on the header information).

The last line is the problem.  It can't be true if your text above is correct.

> > And is Palm certifying the PRC/PDB format is and will be used by the
> > ExgDB calls?  This appears nowhere in any official documentation.
> 
> The .prc and .pdb format were intentionally NOT documented. Since it became
> a defacto standard, we decided to go ahead and publish it. That doesn't mean
> we're going to keep using this format for all eternity! But we're obviously
> aware that changing the .prc/.pdb format would have serious consequences. As
> for the ExgDB calls, we need to maintain the current behavior if we want
> beaming apps to work between Palm devices. Again, we won't change it without
> a good reason.
> 
> > Also note that if 1. is true, there may be some unpleasant sideeffects
> > from taking the documentation too literally (e.g. if the TCP/IP
> > stalls, you might not want to return a nonzero length, but if you
> > don't return, the user can't send an event to cancel).
> 
> I think you want to return an error in this case. If you return "nothing
> more to read" and you're in the last record or resource, the system will
> just build a database with the last record or resource clipped.


Read ExgDBRead docs again - if I return any error, it ends the
transaction and deletes what it has received so far.

Actually the Palm Docs are quite good and comprehensive, but here is a
case where I keep pointing out a contradiction and can't even get Palm
to acknowledge the Document is wrong (and has been for a while).

Then the callbacks don't work as the reference manual says they should.

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

Reply via email to