hi,

[repost after earlier posting was mangled up with some HTML tags]

I did some tests with the in-memory database and didn't find any way to use 
the in-memory database from multiple db handles in the same process. Having 
this capability would enable a multithreaded application to have e.g. multiple 
read transactions (each with its own db handle) to run in parallel.

As far as I could see this is not possible. Correct? The implementation in 
function sqlite3BtreeOpen() seems to ignore any setting of 
sqlite3SharedCacheEnabled() if it is a in-memory database. What about having 
in-memory databases named like: ":memory:". So as to be 
able to indicate to sqlite3_open_v2() to create multiple in-memory db handlers 
sharing the same btree.

Actually after a quick and dirty hack in btree.c's sqlite3BtreeOpen() 
things _seem_ to work correctly. Of course this is not in any way how it should 
be done, but I didn't see a quick way to give in-memory databases a name so 
that can be used in the search for existing in-memory databases. But it 
indicates that the btree can be shared also for in-memory databases.


  //FIXME-XXX originally this is isMemdb=0
  if( (flags & BTREE_PRIVATE)==0
   && isMemdb==1 

  //FIXME-XXX originally this is strcmp(zFulPathname, ...
  if( 0==strcmp("", sqlite3PagerFilename(pBt->pPager)) 
                 && sqlite3PagerVfs(pBt->pPager)==pVfs ){

What do you think? I think I could manage to correctly hack the sqlite code so 
that it provides naming for :memory: databases. Of course only if the basic 
sharing of memory databases between multiple db handles is supposed to work.

Markus
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to