1 | |
---|
2 | /* |
---|
3 | Copyright 2013 Willem Vermin, SURFsara |
---|
4 | |
---|
5 | Licensed under the Apache License, Version 2.0 (the "License"); |
---|
6 | you may not use this file except in compliance with the License. |
---|
7 | You may obtain a copy of the License at |
---|
8 | |
---|
9 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | |
---|
11 | Unless required by applicable law or agreed to in writing, software |
---|
12 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | See the License for the specific language governing permissions and |
---|
15 | limitations under the License. |
---|
16 | */ |
---|
17 | #ifndef MYSQL_POOL_H |
---|
18 | #define MYSQL_POOL_H |
---|
19 | #include "stopos_pool.h" |
---|
20 | #include "stopos_key.h" |
---|
21 | #include "mysql_connection.h" |
---|
22 | #include "stopos.h" |
---|
23 | #include <cppconn/driver.h> |
---|
24 | #include <cppconn/exception.h> |
---|
25 | #include <cppconn/resultset.h> |
---|
26 | #include <cppconn/statement.h> |
---|
27 | #include <cppconn/prepared_statement.h> |
---|
28 | |
---|
29 | class mysql_pool: public stopos_pool |
---|
30 | { |
---|
31 | private: |
---|
32 | |
---|
33 | int get_record(std::string &r, const std::string &k, const std::string &l); |
---|
34 | int put_record(const std::string &r, const std::string &k, const std::string &l); |
---|
35 | int remove_record(const std::string &k, const std::string &l); |
---|
36 | |
---|
37 | void create_fname(std::string &fname,const stopos_key &k); |
---|
38 | |
---|
39 | std::string key_to_slot(const std::string &k){return "";} |
---|
40 | |
---|
41 | sql::Connection *connection; |
---|
42 | sql::Statement *stmt; |
---|
43 | |
---|
44 | public: |
---|
45 | mysql_pool(); |
---|
46 | ~mysql_pool(); |
---|
47 | int create_db(const std::string &dbname); |
---|
48 | int purge_db(void); |
---|
49 | int open_db(void); |
---|
50 | int close_db(void); |
---|
51 | }; |
---|
52 | #endif |
---|