hi,
Just to let you know. I did some more tests, skimmed through the source code.
Here a quick description of how it works:
(1)
If shared cache is disabled, each call to sqlite3_open() will result in a db
handle with its own btree and page cache. If the page cache is not shared, each
db handle needs to refresh its page cache from disk if some other thread or
process using some othert db handle has written to the database. The magic
piece of code is in pager.c: pagerSharedLock().
if( memcmp(pPager->dbFileVers,
dbFileVers, sizeof(dbFileVers))!=0 ){
pager_reset(pPager);
}
If the version number read from file on disk is different than the version
number in memorr, reset the pager cache.
(2)
If shared cache is enabled, and it's a disk-based database (not in-memory,
not temporary) each call to sqlite3_open() results in a db handle that points
to the same shared btree and page cache (the relevant code can be seen in the
implementation of sqlite3BtreeOpen() ). This also means that if there's a
write transaction from any of the db handles, the page cache version number is
increased. This eventually leads to the fact the version number on disk and
version number I page cache are the same. I.e. no reload happens.
Hope that helps bit.
Markus
<img src="http://www.bigstring.com/refer.php?img=65" width="1" height="1">Send
Self-Destructing Instant Messages with BigString's new IM. Share your thoughts
and ideas without the worry of what the receiving party may be retaining.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users