[odb-users] Prepared statement factory question

Boris Kolpackov boris at codesynthesis.com
Fri Sep 22 03:08:43 EDT 2023


Патрушев Данил Андреевич <d.patrushev at prosoftsystems.ru> writes:

> It looks like methods
>
> bool database::call_query_factory (const char* name, connection_type& c) const
> void database::query_factory (const char* name, query_factory_wrapper w)
>
> are not thread-safe. Is it by design or an oversight?

Yes, this is by design. I've added[1] the following paragraph to the
manual to make this explicit:

"Note that the database::query_factory() function is not thread-safe and
should be called before starting any threads that may require this
functionality. Usually, all the prepared query factories are registered as
part of the database instance creation."

[1] https://git.codesynthesis.com/cgit/odb/odb/commit/?id=df4bbe5582d7



More information about the odb-users mailing list