blob: 13078a986b44702fa0ab454a15cdbd6a16bdda71 [file] [log] [blame]
Alison Craig2a4d5282015-04-10 12:00:02 -06001/** NDN-Atmos: Cataloging Service for distributed data originally developed
2 * for atmospheric science data
3 * Copyright (C) 2015 Colorado State University
4 *
5 * NDN-Atmos is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * NDN-Atmos is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NDN-Atmos. If not, see <http://www.gnu.org/licenses/>.
17**/
18
19#ifndef ATMOS_UTIL_CONNECTION_DETAILS_HPP
20#define ATMOS_UTIL_CONNECTION_DETAILS_HPP
21
22#include "mysql/mysql.h"
Alison Craig2a4d5282015-04-10 12:00:02 -060023#include <memory>
24#include <string>
Chengyu Fan31737f12016-01-12 21:08:50 -070025#include <zdb/zdb.h>
Alison Craig2a4d5282015-04-10 12:00:02 -060026
27namespace atmos {
28namespace util {
Chengyu Fan31737f12016-01-12 21:08:50 -070029
30#define MAX_DB_CONNECTIONS 100
31
Chengyu Fan46398212015-08-11 11:23:13 -060032enum DatabaseOperation {CREATE, UPDATE, ADD, REMOVE, QUERY};
Alison Craig2a4d5282015-04-10 12:00:02 -060033struct ConnectionDetails {
34public:
35 std::string server;
36 std::string user;
37 std::string password;
38 std::string database;
39
40 ConnectionDetails(const std::string& serverInput, const std::string& userInput,
41 const std::string& passwordInput, const std::string& databaseInput);
42};
43
Chengyu Fan31737f12016-01-12 21:08:50 -070044std::shared_ptr<ConnectionPool_T>
45zdbConnectionSetup(const ConnectionDetails& details);
Alison Craig2a4d5282015-04-10 12:00:02 -060046
47} // namespace util
48} // namespace atmos
49#endif //ATMOS_UTIL_CONNECTION_DETAILS_HPP