James Gregurich wrote:
>> You will have to open the memory database and attach the db file since
>> SQLite can't attach to a memory database.
> 
> is this information wrong?  
> http://www.blitzbasic.com/Community/posts.php?topic=60981
> 

No it's not. I was mistaken. SQLite can attach a memory database to an 
open connection, even another memory database.

Each such memory database is independent, and there is no way to use an 
existing memory database in an attach command. Attaching to a memory 
database always creates a new empty in memory database.

To share an attached database the threads must be able to name it, and 
this is only possible with a file database.


> yes. the nature of the application is such that the data is loaded  
> from a proprietary file format, processed, and presented to the user.  
> There is no need to store the data back on disk. 

One of the best uses of SQlite is as an application's file format. See 
http://www.sqlite.org/cvstrac/wiki?p=WhenToUseSqlite for more info. 
Perhaps you can replace the proprietary file format with a permanent 
SQLite database file (and then again maybe not).


> I'm interested in a flexible, convenient, in-memory datastore. I  
> thought it was going to work but was stopped dead in my tracks when I  
> realized I couldn't open multiple connections on an in-memory db.

You could implement a server thread that accesses a single memory 
database which accepts commands from, and passes the results back to, 
your other threads as John suggested. You will have to provide some form 
of resource management for the shared resource, whether it is a shared 
memory database, file, or something else.

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to