Experimental start of database OO abstraction layer.
[gnucomo.git] / src / include / database.h
index 2060cb5..1d94e64 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : database.h
 **      SYSTEM NAME    : 
-**      VERSION NUMBER : $Revision: 1.9 $
+**      VERSION NUMBER : $Revision: 1.11 $
 **
 **  DESCRIPTION      :  Classes to provide an abstract layer on the Gnucomo
 **                      database.
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Sep 10, 2002
-**      LAST UPDATE     : Aug 27, 2003
+**      LAST UPDATE     : Aug 19, 2005
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: database.h,v $
-   Revision 1.9  2003-09-02 12:54:10  arjen
+   Revision 1.11  2007-01-11 13:50:10  arjen
+   Experimental start of database OO abstraction layer.
+
+   Revision 1.10  2003/12/04 10:39:36  arjen
+   Fixed libpqxx headers
+
+   Revision 1.9  2003/09/02 12:54:10  arjen
    Overloaded gnucomo_database::Field() to include the Result
    from a query as an argument.
 
 
 *****************************/
 
-/* static const char *RCSID = "$Id: database.h,v 1.9 2003-09-02 12:54:10 arjen Exp $"; */
+/* static const char *RCSID = "$Id: database.h,v 1.11 2007-01-11 13:50:10 arjen Exp $"; */
 
+#include <pqxx/connection.h>
 #include <pqxx/transaction.h>
+#include <pqxx/result.h>
 #include "gnucomo_config.h"
 
 /*
@@ -159,3 +167,40 @@ public:
    String new_notification(String objectid, String issue, String remark);
 };
 
+/*
+///////////////////////////////////////////////////////////////////////////
+//  NAME           : database_entity
+//  BASECLASS      : 
+//  MEMBERS        :
+//  OPERATORS      :
+//  METHODS        : 
+//
+//  DESCRIPTION    : 
+//
+//  RELATIONS      :
+//  SEE ALSO       :
+//  LAST MODIFIED  : Aug 19, 2005
+///////////////////////////////////////////////////////////////////////////
+*/
+
+class database_entity
+{
+   const gnucomo_database  *db;
+   String    table;
+
+   bool fresh;       // Completely new, no tuple in the database
+   bool changed;     // A database update is needed
+   bool deleted;     // Tuple is to be deleted from the database
+
+public:
+
+  database_entity(const gnucomo_database &gdb, const String tbl)
+  {
+     db = &gdb;
+     table = tbl;
+
+     fresh = true;
+     changed = false;
+     deleted = false;
+  }
+};