All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QueryRunner.h
Go to the documentation of this file.
1 /*
2  * QueryRunner.h
3  *
4  * This file is part of the HausmiSEP project
5  *
6  * Copyright (C) 2012, 2013 Marco Alvarado (malvcr@gmail.com)
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef QUERYRUNNER_H_
23 #define QUERYRUNNER_H_
24 
25 #include <HSEPData/DB.h>
26 #include <HSEPData/DBBase.h>
27 #include <HSEPData/ErrorCode.h>
28 #include <HSEP/HSEPObject.h>
29 #include <string>
30 
31 using namespace std;
32 
33 namespace HSEPData {
34 
43  class QueryRunner : public HSEPObject {
44 
45  string aDBType;
46  DBEnvironment* aEnvironment;
47 
48  protected:
49 
59  ErrorCode prepareStatement(DBStatement*& pStatement, string& pStatementName);
60 
68  void storeData(string& pDestination, string& pStatementName);
77  void storeData(string& pDestination, string& pStatementName, DBParameters& pParametersRef);
78 
79  public:
80  QueryRunner(string pDBType);
81  ~QueryRunner();
82 
93  ErrorCode execute(
94  string pStatementName,
95  DBParameters& pParametersRef,
96  CycleBase& pCycleRunnerRef
97  );
106  ErrorCode execute(
107  string pStatementName,
108  DBParameters& pParametersRef
109  );
120  ErrorCode execute(
121  string pStatementName,
122  DBParameters& pParametersRef,
123  ExecuteFunctionType pFunction
124  );
125 
135  ErrorCode execute(
136  string pStatementName,
137  CycleBase& pCycleRunnerRef
138  );
139 
149  ErrorCode execute(
150  string pStatementName,
151  ExecuteFunctionType pFunction
152  );
153 
154  }; // QueryRunner class
155 
156 } // HSEPData namespace
157 
158 #endif /* QUERYRUNNER_H_ */