implemented prepared statement for postgres and sqlite

This commit is contained in:
2023-12-09 11:08:03 +01:00
parent 8ba70cc79e
commit da423ea8bb
59 changed files with 1769 additions and 314 deletions
@@ -14,6 +14,8 @@
#include "matador/sql/connection_impl.hpp"
#include <unordered_map>
#include <libpq-fe.h>
namespace matador::backends::postgres {
@@ -27,7 +29,7 @@ public:
bool is_open() override;
std::unique_ptr<sql::query_result_impl> fetch(const std::string &stmt) override;
void prepare(const std::string &stmt) override;
std::unique_ptr<sql::statement_impl> prepare(sql::query_context context) override;
size_t execute(const std::string &stmt) override;
@@ -35,8 +37,15 @@ public:
bool exists(const std::string &table_name) override;
private:
[[nodiscard]] static std::string generate_statement_name(const sql::query_context &query) ;
private:
PGconn *conn_{nullptr};
using string_to_int_map = std::unordered_map<std::string, unsigned long>;
static string_to_int_map statement_name_map_;
};
}