[odb-users] Handling Multiple Databases/Threads in ODB

Sum, Eric B eric.b.sum at lmco.com
Tue Jul 31 07:34:29 EDT 2012


Hi,

I have 2 questions/issues:


1.        I was wondering if there is documentation or examples in the odb manual for dealing with multiple databases.  I may have missed this section in the manual.  The only example/mention that I found was in the transaction section, in which it describes how to switch between current active transactions within the same thread.  I assume that you just create two database instances and work with each instance individually:

auto_ptr<database> db1 (new odb::sqlite::database("DB1.sql", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
auto_ptr<database> db2 (new odb::sqlite::database("DB2.sql", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));

//start a transaction and do stuff with d1
//start a transaction and do stuff with db2

I'm just asking to make sure that I'm not missing out on some extra support that could be useful.


2.        In a previous email, it was mentioned to me that sqlite now supports multiple thread access to an in-memory database.  Is there some documentation in the odb manual describing how odb supports multiple-thread access to sqlite databases and/or some sort of locking scheme for database access to prevent data corruption when using multiple threads?

These questions are purely for reference purposes so that I know where to look as I could not find sections in the manual specifically for this and may well have missed them.  If not, I understand for the most part how to implement them.  I am just wondering if there is any odb functionality pertaining to these issues that I am missing out on.

Thanks so much for the help.  I appreciate it.
-Eric



More information about the odb-users mailing list