Home
Download
API Documentation
Development
src
query
database_manager.h
1
/*
2
* <one line to give the program's name and a brief idea of what it does.>
3
* Copyright (C) 2023 Jose F Rivas C <email>
4
*
5
* This program 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
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef NAF_QUERY_DATABASE_MANAGER
20
#define NAF_QUERY_DATABASE_MANAGER
21
22
23
#include <iostream>
24
#include <memory>
25
#include <string>
26
#include <mutex>
27
28
#include "Poco/Exception.h"
29
#include "Poco/Data/Session.h"
30
#include "Poco/Data/MySQL/Connector.h"
31
#include <Poco/Data/MySQL/MySQLException.h>
32
#include <Poco/Data/Statement.h>
33
34
//#include "tools/settings_manager.h"
35
36
37
namespace
NAF
38
{
39
namespace
Query
40
{
41
class
DatabaseManager;
42
}
43
}
44
45
using namespace
Poco;
46
using namespace
Poco::Data;
47
using namespace
Poco::Data::Keywords;
48
49
class
SettingsManager;
50
class
NAF::Query::DatabaseManager
51
{
52
public
:
53
DatabaseManager
();
54
~
DatabaseManager
();
55
56
static
void
StartMySQL_();
57
static
void
StopMySQL_();
58
static
std::shared_ptr<Data::Session> StartSessionMySQL_();
59
60
private
:
61
static
std::mutex mutex_;
62
static
bool
initialized_;
63
64
};
65
66
#endif
// NAF_QUERY_DATABASE_MANAGER
NAF::Query::DatabaseManager
Definition:
database_manager.h:51