[odb-users] A view on top of several tables from different sqlite files (DB)

Boris Kolpackov boris at codesynthesis.com
Tue Sep 8 11:05:03 EDT 2015


Hi Yoav,

Weiss, Yoav <yoav.weiss at intel.com> writes:

> My issue was resolved. I simply saved the connection ptr (by using
> the database::connection() API) and used it for all subsequent
> queries and transactions. 

Glad to hear it is working now.

For completeness, if you don't want to have to deal with connection_ptr,
then the "proper" way to implement this would be to provide a derived
connection_pool implementation that attaches all the necessary databases
for every connection that is created. If you are interested, see Section
18.3, "SQLite Connection and Connection Factory". The function you would
want to override is connection_pool_factory::create() in which you would
first call the base version to actually create the connection and then
attach all the databases to it before returning.

Boris



More information about the odb-users mailing list