libdballe
5.18
|
00001 /* 00002 * db/context - context table management 00003 * 00004 * Copyright (C) 2005--2010 ARPA-SIM <urpsim@smr.arpa.emr.it> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * Author: Enrico Zini <enrico@enricozini.com> 00020 */ 00021 00022 #ifndef DBALLE_DB_CONTEXT_H 00023 #define DBALLE_DB_CONTEXT_H 00024 00031 #include <dballe/db/odbcworkarounds.h> 00032 #include <sqltypes.h> 00033 #include <cstdio> 00034 00035 namespace dballe { 00036 struct DB; 00037 00038 namespace db { 00039 struct Connection; 00040 struct Statement; 00041 00045 struct Context 00046 { 00050 DB& db; 00051 00053 db::Statement* sstm; 00055 db::Statement* sdstm; 00057 db::Statement* istm; 00059 db::Statement* dstm; 00060 00062 DBALLE_SQL_C_SINT_TYPE id; 00063 00065 DBALLE_SQL_C_SINT_TYPE id_station; 00067 DBALLE_SQL_C_SINT_TYPE id_report; 00069 SQL_TIMESTAMP_STRUCT date; 00071 DBALLE_SQL_C_SINT_TYPE ltype1; 00073 DBALLE_SQL_C_SINT_TYPE l1; 00075 DBALLE_SQL_C_SINT_TYPE ltype2; 00077 DBALLE_SQL_C_SINT_TYPE l2; 00079 DBALLE_SQL_C_SINT_TYPE pind; 00081 DBALLE_SQL_C_SINT_TYPE p1; 00083 DBALLE_SQL_C_SINT_TYPE p2; 00084 00085 Context(DB& db); 00086 ~Context(); 00087 00094 int get_id(); 00095 00102 void get_data(int id); 00103 00112 int obtain_station_info(); 00113 00120 int insert(); 00121 00125 void remove(); 00126 00130 void dump(FILE* out); 00131 00132 private: 00133 // disallow copy 00134 Context(const Context&); 00135 Context& operator=(const Context&); 00136 }; 00137 00138 } // namespace db 00139 } // namespace dballe 00140 00141 /* vim:set ts=4 sw=4: */ 00142 #endif