libdballe 5.10
|
00001 /* 00002 * db/attr - attr 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_ATTR_H 00023 #define DBALLE_DB_ATTR_H 00024 00031 #include <dballe/db/odbcworkarounds.h> 00032 #include <wreport/var.h> 00033 #include <sqltypes.h> 00034 #include <cstdio> 00035 00036 namespace dballe { 00037 struct DB; 00038 00039 namespace db { 00040 struct Connection; 00041 struct Statement; 00042 00046 struct Attr 00047 { 00049 db::Connection& conn; 00050 00052 db::Statement* sstm; 00054 db::Statement* istm; 00056 db::Statement* rstm; 00057 00059 DBALLE_SQL_C_SINT_TYPE id_context; 00061 wreport::Varcode id_var; 00063 wreport::Varcode type; 00065 char value[255]; 00067 SQLLEN value_ind; 00068 00069 Attr(Connection& conn); 00070 ~Attr(); 00071 00078 void set(const wreport::Var& var); 00079 00086 void set_value(const char* value); 00087 00096 void insert(bool replace); 00097 00106 void load(wreport::Var& var); 00107 00111 void dump(FILE* out); 00112 00113 private: 00114 // disallow copy 00115 Attr(const Attr&); 00116 Attr& operator=(const Attr&); 00117 }; 00118 00119 } // namespace db 00120 } // namespace dballe 00121 00122 /* vim:set ts=4 sw=4: */ 00123 #endif