22 #ifndef DBALLE_DB_SQL_DATAV6_H 23 #define DBALLE_DB_SQL_DATAV6_H 32 #include <wreport/var.h> 75 virtual void dump(FILE* out) = 0;
83 static const unsigned FLAG_NEEDS_UPDATE = 1 << 0;
84 static const unsigned FLAG_UPDATED = 1 << 1;
85 static const unsigned FLAG_NEEDS_INSERT = 1 << 2;
86 static const unsigned FLAG_INSERTED = 1 << 3;
89 bool needs_update()
const {
return flags & FLAG_NEEDS_UPDATE; }
90 bool updated()
const {
return flags & FLAG_UPDATED; }
91 bool needs_insert()
const {
return flags & FLAG_NEEDS_INSERT; }
92 bool inserted()
const {
return flags & FLAG_INSERTED; }
93 void set_needs_update() { flags |= FLAG_NEEDS_UPDATE; }
94 void set_updated() { flags = (flags & ~FLAG_NEEDS_UPDATE) | FLAG_UPDATED; }
95 void set_needs_insert() { flags |= FLAG_NEEDS_INSERT; }
96 void set_inserted() { flags = (flags & ~FLAG_NEEDS_INSERT) | FLAG_INSERTED; }
103 void format_flags(
char* dest)
const;
113 const wreport::Var* var;
115 VarV6(
const wreport::Var* var,
int id_levtr=-1,
int id_data=-1)
116 : id_levtr(id_levtr), id_data(id_data), var(var)
119 bool operator<(
const VarV6& v)
const 121 if (
int d = id_levtr - v.id_levtr)
return d < 0;
122 return var->code() < v.var->code();
125 void dump(FILE* out)
const;
139 void add(
const wreport::Var* var,
int id_levtr)
141 emplace_back(var, id_levtr);
144 void dump(FILE* out)
const;
154 InsertV6::iterator iter;
155 bool do_insert =
false;
156 bool do_update =
false;
160 bool annotate(
int id_data,
int id_levtr, wreport::Varcode code,
const char* value);
163 void dump(FILE* out)
const;
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Helper class for annotating InsertV6 variables with the current status of the database.
Definition: sql/datav6.h:151
Definition: sql/datav6.h:81
A RAII transaction interface.
Definition: sql.h:134
Input for a bulk insert of a lot of variables sharing the same context information.
Definition: sql/datav6.h:133
Workflow information about a variable listed for bulk insert/update.
Definition: sql/datav6.h:109
Date and time.
Definition: types.h:147
Build SQL queries for V6 databases.
Definition: qbuilder.h:15
Precompiled query to manipulate the data table.
Definition: sql/datav6.h:57