libdballe  5.18
db/context.h
Go to the documentation of this file.
1 /*
2  * db/context - context 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_CONTEXT_H
23 #define DBALLE_DB_CONTEXT_H
24 
32 #include <sqltypes.h>
33 #include <cstdio>
34 
35 namespace dballe {
36 struct DB;
37 
38 namespace db {
39 struct Connection;
40 struct Statement;
41 
45 struct Context
46 {
50  DB& db;
51 
60 
62  DBALLE_SQL_C_SINT_TYPE id;
63 
65  DBALLE_SQL_C_SINT_TYPE id_station;
67  DBALLE_SQL_C_SINT_TYPE id_report;
69  SQL_TIMESTAMP_STRUCT date;
71  DBALLE_SQL_C_SINT_TYPE ltype1;
73  DBALLE_SQL_C_SINT_TYPE l1;
75  DBALLE_SQL_C_SINT_TYPE ltype2;
77  DBALLE_SQL_C_SINT_TYPE l2;
79  DBALLE_SQL_C_SINT_TYPE pind;
81  DBALLE_SQL_C_SINT_TYPE p1;
83  DBALLE_SQL_C_SINT_TYPE p2;
84 
85  Context(DB& db);
86  ~Context();
87 
94  int get_id();
95 
102  void get_data(int id);
103 
112  int obtain_station_info();
113 
120  int insert();
121 
125  void remove();
126 
130  void dump(FILE* out);
131 
132 private:
133  // disallow copy
134  Context(const Context&);
135  Context& operator=(const Context&);
136 };
137 
138 } // namespace db
139 } // namespace dballe
140 
141 /* vim:set ts=4 sw=4: */
142 #endif