#include <pqxx/result>
#include "gnucomo_config.h"
+#define DEBUG
+
/*
///////////////////////////////////////////////////////////////////////////
// NAME : gnucomo_database
class database_entity
{
- const gnucomo_database *db;
+ gnucomo_database *db;
String table;
+ String connected_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
+protected:
+
+ std::map<String,String> fields;
+
public:
- database_entity(const gnucomo_database &gdb, const String tbl)
- {
- db = &gdb;
- table = tbl;
+ database_entity(gnucomo_database &gdb, const String tbl)
+ {
+ db = &gdb;
+ table = tbl;
+
+ fresh = true;
+ changed = false;
+ deleted = false;
+ }
+
+ // contruct a new database entity from the result of another one
+ database_entity(database_entity *from, int row);
+
+ int find_one(String key);
+ int find_many(String tab, String where);
- fresh = true;
- changed = false;
- deleted = false;
- }
};