added sqlite db backend progress
This commit is contained in:
@@ -3,29 +3,39 @@
|
||||
|
||||
#include "matador/utils/library.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace matador::sql {
|
||||
|
||||
class connection_impl;
|
||||
struct connection_info;
|
||||
class dialect;
|
||||
|
||||
class backend_provider
|
||||
{
|
||||
public:
|
||||
explicit backend_provider(std::string backends_path);
|
||||
private:
|
||||
backend_provider();
|
||||
|
||||
connection_impl* create_connection(const std::string &connection_type);
|
||||
public:
|
||||
static backend_provider& instance();
|
||||
|
||||
connection_impl* create_connection(const std::string &connection_type, const connection_info &info);
|
||||
void destroy_connection(const std::string &connection_type, connection_impl *c);
|
||||
const dialect& connection_dialect(const std::string &connection_type);
|
||||
|
||||
private:
|
||||
struct backend_context {
|
||||
backend_context(const std::string &connection_type,
|
||||
const std::string &backends_path);
|
||||
backend_context(const backend_context&) = delete;
|
||||
backend_context& operator=(const backend_context&) = delete;
|
||||
backend_context(backend_context&&) noexcept = default;
|
||||
backend_context& operator=(backend_context&&) noexcept = default;
|
||||
~backend_context();
|
||||
|
||||
typedef connection_impl*(*create_func)();
|
||||
typedef connection_impl*(*create_func)(const connection_info&);
|
||||
typedef void (*destroy_func)(connection_impl*);
|
||||
typedef const dialect*(*dialect_func)();
|
||||
|
||||
@@ -35,7 +45,7 @@ private:
|
||||
utils::library lib;
|
||||
};
|
||||
private:
|
||||
using backends_t = std::unordered_map<std::string, backend_context>;
|
||||
using backends_t = std::unordered_map<std::string, std::unique_ptr<backend_context>>;
|
||||
backends_t backends_;
|
||||
std::string backends_path_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user