> I want to check the size of my database, to limit it to a certain size, so
> when I call DmDatabaseSize and get back the 'totalBytesP,' field I want to
> compare this against my defined MaxSize.

The value passed back by DmDatabaseSize in *totalBytesP is an approximation
of the number of bytes used to store the database, including overhead. As
Keith pointed out, there are lots of places where this overhead comes from.
IIRC, DmDatabaseSize doesn't take the app info block into account. If you're
limiting the size of a database as part of "crippling" your software, I'd
stick with *dataBytesP. It's easier to predict how changes to the data will
affect this number. You shouldn't embed knowledge of the overhead into your
app. It's subject to change in a future version of Palm OS. Alternatively,
limit the number of records. This is much easier to enforce.

This probably isn't an issue for you, but the totalBytes value computed by
DmDatabaseSize is _not_ the same as the number of bytes in the prc/pdb file
used to represent the database on a desktop (or while beaming). It is
similar, but it's not the same. To get the actual number of bytes in the
prc/pdb, use ExgDBWrite and just count the bytes in your callback function.
--
Danny @ PalmSource

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

Reply via email to