[odb-users] ODB exception problem
cetoni GmbH - Uwe Kindler
uwe.kindler at cetoni.de
Thu Jun 9 07:26:54 EDT 2011
while evaluating ODB we stumbled on a serious problem catching
exceptions from libodb.
The following example shows the problem
cout << "Hello World!!!" << endl;
db = boost::shared_ptr<database>(new odb::sqlite::database(
"test.db", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
catch (odb::unknown_schema& ex)
std::cout << ex.what() << std::endl;
std::cout << "Exception" << std::endl;
This application produces the following output:
This application has requested the Runtime to terminate it in an unusual
Please contact the application's support team for more information.
terminate called after throwing an instance of 'odb::unknown_schema'
what(): unknown database schema ''
The "Hello World!!!" message appears on stdout and the rest appares on
stderr if I start the application in eclipse.
If I insert the following line
before odb::schema_catalog::create_schema (*db); then I get the
unknown database schema 'Test'
So it seems like it is not possible to catch exceptions thrown from
libodb because normally the application should run into the first catch
block because odb::schema_catalog::create_schema (*db) throws an
unknown_schema exception like it happens if I insert the throw
odb::unknown_schema("Test") command . This is quite strange because we
use DLLs extensively and never discovered such a problem. We discovered
the problem in our Qt application and I created this tiny exampleto
check if it is a problem of our Qt application or if this problem
MinGW with GCC4.5.1
libodb configuration: ./configure --disable-static
We have no idea what could cause this problem but ist must be something
in libodb compilation or linkage because we never had any problems to
throw exceptions across DLL boundaries.
Any idea what goes wrong here?
Thank you for any help.
More information about the odb-users