[odb-users] query crash

Boris Kolpackov boris at codesynthesis.com
Thu Nov 2 09:33:45 EDT 2017


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

> 1) create a query object in thread number 1
> 
> 2) create a functor (say, lambda) containing the code to execute a database request and copy the query object into the functor
> 
> 3) launch a worker thread and call the functor within that thread's context.
> 
> 4) pass the result back to thread number 1
> 
> Is it safe to use odb:: pgsql::query in this manner?

Probably not. To be more precise I would need more details (maybe code
samples for each step). For example, what is a "query object"? A prepared
query or just the query condition?

Also, what's happening with transactions/connections during all of this?
Are you passing them as well or create new ones in respective threads
(the latter would definitely be a bad idea since the result is "bound"
to the connection of the query).

Boris



More information about the odb-users mailing list