added sqlite connection class (progress)

This commit is contained in:
2023-11-09 19:48:29 +01:00
parent 715f4dff8f
commit 8b5859d858
13 changed files with 227 additions and 25 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef QUERY_BACKEND_PROVIDER_HPP
#define QUERY_BACKEND_PROVIDER_HPP
#include "matador/utils/library.hpp"
#include <string>
#include <unordered_map>
namespace matador::sql {
class connection_impl;
class dialect;
class backend_provider
{
public:
explicit backend_provider(std::string backends_path);
connection_impl* create_connection(const std::string &connection_type);
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();
typedef connection_impl*(*create_func)();
typedef void (*destroy_func)(connection_impl*);
typedef const dialect*(*dialect_func)();
create_func create_connection{};
destroy_func destroy_connection{};
dialect_func get_dialect{};
utils::library lib;
};
private:
using backends_t = std::unordered_map<std::string, backend_context>;
backends_t backends_;
std::string backends_path_;
};
}
#endif //QUERY_BACKEND_PROVIDER_HPP