|
solarpowerlog trunk
|
00001 /* 00002 * _QueryHelper.h 00003 * 00004 * Created on: Feb 7, 2010 00005 * Author: tobi 00006 */ 00007 00008 #ifndef _QUERYHELPER_H_ 00009 #define _QUERYHELPER_H_ 00010 00011 #include <dbixx/dbixx.h> 00012 #include <map> 00013 #include <vector> 00014 #include <boost/any.hpp> 00015 00016 #include "interfaces/PersistanceStorage/IPersistanceStorage.h" 00017 00018 class QueryHelper 00019 { 00020 00021 friend class IPersistanceStorage; 00022 00023 protected: 00024 QueryHelper(dbixx::session *session, std::map<std::string /*identifier*/, 00025 dbtypes /*type*/> *x); 00026 00027 public: 00028 ~QueryHelper(); 00029 00036 int DoQuery(std::vector<std::string> &what, std::string &where); 00037 00043 std::map<std::string, boost::any> 00044 GetNextResult(void); 00045 00046 // std::map<std::string, boost::any> value_mapping; 00047 00048 private: 00049 std::string table; 00050 00051 // Storing the association between type and table entry. 00052 std::map<std::string, dbtypes /*type*/> *table_spec; 00053 00054 // These are the fields in for the last query. 00055 std::vector<std::string> what; 00056 00057 // the database session. 00058 dbixx::session *session; 00059 00060 // the results object of the dbixx abstraction layer. 00061 dbixx::result *r; 00062 00063 }; 00064 00065 #endif /* _QUERYHELPER_H_ */