dbSize calculation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dbSize calculation

zhiting zhu
Hi,

I send this email to the dev mailing list but no response. It seems this
mailing list has more activity and attention. I have a question about how
dbSize is calculated when I was reading the source code of sqlite3. In the
description of the dbSize, it said: "If the size of the file is not an
integer multiple of the page-size, the value stored in dbSize is rounded
down (i.e. a 5KB file with 2K page-size has dbSize==2).
Except, any file that is greater than 0 bytes in size is considered to have
at least one page. (i.e. a 1KB file with 2K page-size leads to dbSize==1)."

But in the pagerPagecount function: the comment said: " If the size of the
database file is not an integer multiple of the page-size, round up the
result." The pagerPagecount function is used to set dbSize in
sqlite3PagerSharedLock function.

The comment at the top is contradicted with the latter. I wonder which way
should be correct? Should it be round up or round down? Thanks!

Best,
Zhiting
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users