[odb-users] Concerns/Pitfalls Using ODB in a Library?

Boris Kolpackov boris at codesynthesis.com
Fri Mar 15 04:35:41 EDT 2019


Brian Coggins <becoggins at hotmail.com> writes:

> Of course, when all this is linked together, libodb will see both
> schema, and ODB instances for both may be active at the same time.
> That’s why I’m asking this question of whether there are any potential
> problems.

Provided both components use the same ODB libraries, I think everything
should work fine.


> One issue I thought of is odb::session, which is thread-specific. If
> X needs to use an odb::session, presumably it should do this on a
> separate thread so that there are no potential conflicts with
> odb::session instances in Y?

odb::session uses the database instance as its first-level key, so
this will work fine even if you have two odb::database instances
of the same type (say SQLite) let alone of different types.


> Will odb::schema_catalog handle things correctly if X and Y
> both invoke it?

Yes, in case of different databases (SQLite and MySQL), they
will again end up with different keys. For the same database,
as Per suggests, you can use database schema names.

So, to summarize, ODB was designed to work in this scenario
and I don't expect there to be any issues. But if there is
any, then it's most likely a bug and we will want to fix it.



More information about the odb-users mailing list