libdballe  5.18
data.h
Go to the documentation of this file.
1 /*
2  * db/data - data table management
3  *
4  * Copyright (C) 2005--2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef DBALLE_DB_DATA_H
23 #define DBALLE_DB_DATA_H
24 
32 #include <wreport/var.h>
33 #include <sqltypes.h>
34 #include <cstdio>
35 
36 namespace dballe {
37 struct DB;
38 
39 namespace db {
40 struct Connection;
41 struct Statement;
42 
46 struct Data
47 {
50 
57 
59  DBALLE_SQL_C_SINT_TYPE id_context;
61  wreport::Varcode id_var;
63  char value[255];
65  SQLLEN value_ind;
66 
68  ~Data();
69 
73  void set(const wreport::Var& var);
74 
78  void set_value(const char* value);
79 
85  void insert_or_fail();
86 
94  bool insert_or_ignore();
95 
102  void insert_or_overwrite();
103 
107  void dump(FILE* out);
108 
109 private:
110  // disallow copy
111  Data(const Data&);
112  Data& operator=(const Data&);
113 };
114 
115 } // namespace db
116 } // namespace dballe
117 
118 /* vim:set ts=4 sw=4: */
119 #endif