X-Git-Url: http://www.andromeda.nl/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdatabase.cpp;h=fb497eca437273747352c1aa3d5eee3f5ddcf838;hb=9c4b92927d11c947302f4817775cb80d33a113fe;hp=82c4332d432c3825271f44ff4ffc3b101d34cead;hpb=6bc39fdbb0b57e58f55ca0c3f5b866962f75953e;p=gnucomo.git diff --git a/src/lib/database.cpp b/src/lib/database.cpp index 82c4332..fb497ec 100644 --- a/src/lib/database.cpp +++ b/src/lib/database.cpp @@ -8,7 +8,7 @@ *********************** ** FILE NAME : database.cpp ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.11 $ +** VERSION NUMBER : $Revision: 1.12 $ ** ** DESCRIPTION : Implementation of the gnucomo database classes ** @@ -26,7 +26,10 @@ /***************************** $Log: database.cpp,v $ - Revision 1.11 2003-12-04 10:40:28 arjen + Revision 1.12 2003-12-22 10:28:26 arjen + Catch an exception if we can not setup a database transaction. + + Revision 1.11 2003/12/04 10:40:28 arjen Fixed name conflict with 'double log(double)' Revision 1.10 2003/12/03 08:23:17 arjen @@ -64,7 +67,7 @@ *****************************/ -static const char *RCSID = "$Id: database.cpp,v 1.11 2003-12-04 10:40:28 arjen Exp $"; +static const char *RCSID = "$Id: database.cpp,v 1.12 2003-12-22 10:28:26 arjen Exp $"; #include @@ -103,9 +106,18 @@ gnucomo_database::gnucomo_database(gnucomo_config *c) } else { - // Create the transaction object + try + { + // Create the transaction object - dbxact = new pqxx::Transaction(*dbconn, "GnuCoMo"); + dbxact = new pqxx::Transaction(*dbconn, "GnuCoMo"); + } + catch (std::exception &e) + { + *Log << "Cannot setup the database transaction: " << e.what() << "\n"; + *Log << "You are probably using incompatible versions of PostgreSQL an libpqxx.\n"; + exit(1); + } gdb_refcount++; } }