libdballe  6.8
v6/attr.h
Go to the documentation of this file.
1 /*
2  * db/v6/attr - attr table management
3  *
4  * Copyright (C) 2005--2013 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_V6_ATTR_H
23 #define DBALLE_DB_V6_ATTR_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 
43 namespace v6 {
44 
48 struct Attr
49 {
52 
59 
61  DBALLE_SQL_C_SINT_TYPE id_data;
63  wreport::Varcode type;
65  char value[255];
67  SQLLEN value_ind;
68 
69  Attr(Connection& conn);
70  ~Attr();
71 
78  void set(const wreport::Var& var);
79 
86  void set_value(const char* value);
87 
94  void insert();
95 
104  void load(wreport::Var& var);
105 
109  void dump(FILE* out);
110 
111 private:
112  // disallow copy
113  Attr(const Attr&);
114  Attr& operator=(const Attr&);
115 };
116 
117 } // namespace v6
118 } // namespace db
119 } // namespace dballe
120 
121 /* vim:set ts=4 sw=4: */
122 #endif
void set(const wreport::Var &var)
Set the input fields using the values in a wreport::Var.
SQLLEN value_ind
attribute value indicator
Definition: v6/attr.h:67
db::Connection & conn
DB connection.
Definition: v6/attr.h:51
DBALLE_SQL_C_SINT_TYPE id_data
id_data SQL parameter
Definition: v6/attr.h:61
db::Statement * rstm
Precompiled replace statement.
Definition: v6/attr.h:58
Database connection.
Definition: internals.h:124
wreport::Varcode type
attribute id SQL parameter
Definition: v6/attr.h:63
Precompiled queries to manipulate the attr table.
Definition: v6/attr.h:48
The ODBC specification is imperfect with regards to integer sizes on 64bit platforms, and different ODBC drivers are currently interpreting it differently.
Definition: cmdline.h:34
void load(wreport::Var &var)
Load from the database all the attributes for var.
char value[255]
attribute value SQL parameter
Definition: v6/attr.h:65
void set_value(const char *value)
Set the value input field from a string.
ODBC statement.
Definition: internals.h:220
void dump(FILE *out)
Dump the entire contents of the table to an output stream.
db::Statement * sstm
Precompiled select statement.
Definition: v6/attr.h:54
void insert()
Insert an entry into the attr table.
db::Statement * istm
Precompiled insert statement.
Definition: v6/attr.h:56