AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
sqlSharedLibraries.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <string>
23#include <map>
24#include <memory>
25
26#include "connection.hpp"
27#include "singleton.hpp"
28
29
30namespace anch::sql {
31
41 std::string layer;
42
44 void* _layer;
45
47 std::shared_ptr<Connection> (*make_shared_connection)(const SqlConnectionConfiguration&);
48
51 };
52
60 class SQLSharedLibraries: public anch::Singleton<SQLSharedLibraries> {
62
63 // Attributes +
64 private:
66 std::map<std::string,anch::sql::SQLSharedLibrary> _libraries;
67 // Attributes -
68
69 // Constructors +
70 private:
74 SQLSharedLibraries() noexcept;
75
81 SQLSharedLibraries(const SQLSharedLibraries& other) = delete;
82 // Constructors -
83
84 // Destructor +
85 private:
89 virtual ~SQLSharedLibraries();
90 // Destructor -
91
92 // Methods +
93 public:
101 void registerSQLLibrary(const std::string& db, const std::string& library);
102
112 std::shared_ptr<Connection> makeSharedConnection(const SqlConnectionConfiguration& config);
113
124
128 static void registerMySQL();
129
133 static void registerPostgreSQL();
134
138 static void registerSQLite();
139 // Methods -
140
141 };
142
143}
144
145#include "sql/impl/sqlSharedLibraries.hpp"
Meyers' singleton implementation.
Definition singleton.hpp:34
SQL connection virtual class.
Definition connection.hpp:71
Connection * makeConnection(const SqlConnectionConfiguration &config)
std::shared_ptr< Connection > makeSharedConnection(const SqlConnectionConfiguration &config)
void registerSQLLibrary(const std::string &db, const std::string &library)
SQL namespace.
Definition clauses.hpp:26
SQL shared library data.
Definition sqlSharedLibraries.hpp:39
void * _layer
Definition sqlSharedLibraries.hpp:44
std::shared_ptr< Connection >(* make_shared_connection)(const SqlConnectionConfiguration &)
Definition sqlSharedLibraries.hpp:47
std::string layer
Definition sqlSharedLibraries.hpp:41
SQL database connection configuration.
Definition connection.hpp:39