Adjusted to new version of libpqxx.
[gnucomo.git] / src / lib / database.cpp
index fb497ec..c585712 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : database.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.12 $
+**      VERSION NUMBER : $Revision: 1.13 $
 **
 **  DESCRIPTION      :  Implementation of the gnucomo database classes
 **
 
 /*****************************
    $Log: database.cpp,v $
-   Revision 1.12  2003-12-22 10:28:26  arjen
+   Revision 1.13  2011-03-24 10:21:47  arjen
+   Adjusted to new version of libpqxx.
+
+   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
 
 *****************************/
 
-static const char *RCSID = "$Id: database.cpp,v 1.12 2003-12-22 10:28:26 arjen Exp $";
+static const char *RCSID = "$Id: database.cpp,v 1.13 2011-03-24 10:21:47 arjen Exp $";
 
 #include <AXE/date.h>
 
+//#define DEBUG
+
 #include "database.h"
 
 extern std::ostream *Log;
@@ -98,7 +103,7 @@ gnucomo_database::gnucomo_database(gnucomo_config *c)
 {
    cfg = c;
 
-   dbconn = new pqxx::Connection(cfg->Database());
+   dbconn = new pqxx::connection(cfg->Database());
 
    if (!dbconn->is_open())
    {
@@ -110,7 +115,8 @@ gnucomo_database::gnucomo_database(gnucomo_config *c)
       {
          // Create the transaction object
 
-         dbxact = new pqxx::Transaction(*dbconn, "GnuCoMo");
+         //dbxact = new pqxx::transaction<pqxx::serializable>(*dbconn, "GnuCoMo");
+         dbxact = new pqxx::work(*dbconn, "GnuCoMo");
       }
       catch (std::exception &e)
       {
@@ -146,7 +152,7 @@ gnucomo_database::~gnucomo_database()
 {
    if (--gdb_refcount == 0 && dbconn != 0 && dbxact != 0)
    {
-      dbxact->Commit();
+      dbxact->commit();
       delete dbxact;
       dbxact = 0;
       delete dbconn;