The way the ExgDBWrite function works is that it takes a function
pointer (WriteProc) as one of its arguments and the OS repeatedly calls
that function with a pointer to some database information that the
WriteProc function should write to the output of its choice.  The OS also
passes in a number of bytes to write and expects the function
doing the writing to update it with the number of bytes written.
The theory is if it can't write all the bytes it will return
what it was able to write and the next time it will be called
with the pointer updated to the correct next bytes to be
written.  As Danny Epstein wrote earlier:
 
"The amount of data being written is determined by a collaboration of
ExgDBWrite and your WriteProc. ExgDBWrite is asking your WriteProc to write
out some number of bytes, but you don't have to write them all. If you write
fewer bytes, you must set *sizeP to the number of bytes actually written. In
this case, it will have to call your WriteProc again to write the rest. Even
if your WriteProc always writes all the data given to it, it'll still get
called multiple times. ExgDBWrite will call your WriteProc for each
record/resource, among other things."
 
 
Now, if I use the following function as the WriteProc I would expect
that it would continually get called with the same parameters:
 
Err WriteProc( const void *dataP, UInt32 *sizeDataP, void *userDataP )
{
    PrintLog( "OS asking to send %ld bytes", *sizeDataP );
    *sizeDataP = 0;
    return 0;
}
 
 
The output from this is:
 
OS asking to send 72 bytes
OS asking to send 6 bytes
OS asking to send 8 bytes
OS asking to send 8 bytes
OS asking to send 2 bytes
OS asking to send 18 bytes
OS asking to send 1166 bytes
 
This tells me it is ignoring whatever I set *sizeDataP to and looking
at the source for ExgDBWrite in ExgDB.c would support this.
 
What's going on with ExgDBWrite?  Has it ever been tested with a
WriteProc that doesn't write all the bytes the first time?
 
Thanks...
 
Adrian Pfisterer.

-- 
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