[odb-users] not_in_transaction exception with sqlite

Boris Kolpackov boris at codesynthesis.com
Mon May 21 11:27:01 EDT 2012


Hi Łukasz,

Łukasz Jaroszewski <jaroszewski.luk at gmail.com> writes:

> My problem is that, when I try to use create_schema or db->persist(x)
> i get an exception: not_in_transaction.
> 
> odb::transaction t (db.begin ());
> db.persist (x);
> t.commit ();
> 
> t.has_current() returns true and db.execute("select * from sometabme")
> returns exactly row count I have in db. So connection Is ok, I think.

Yes, this is very strange, particularly because database::execute()
also checks for the current transaction, just like database::persist().
So the fact that you are getting this exception from one but not from
the other is particularly strange.

The transaction "current" machinery uses TLS, unless threads are 
disabled. And my only guess is that TLS does not work properly in
your configuration for some reason. ODB also tries to use compiler
support for TLS, if available, and falls back on the operating
system API. So maybe one of these mechanisms is not working as
expected. To explore this possibility further, it would be helpful
to know which platform you are on, which compiler you are using,
as well as if you are doing anything special (e.g., disabled thread
support, static linking, etc).

Another thing that you can try is build and run one of the examples
from the odb-examples package (say, 'hello'). It would be interesting
to see if it fails in a similar way.

Boris



More information about the odb-users mailing list