added data binding traits

This commit is contained in:
2023-12-11 17:20:42 +01:00
parent 8ad13076c8
commit 1c92e07173
17 changed files with 378 additions and 146 deletions
+6 -4
View File
@@ -1,14 +1,16 @@
#include "matador/sql/connection.hpp"
#include "matador/sql/statement_cache.hpp"
namespace matador::sql {
statement &statement_cache::acquire(const std::string &stmt, const connection &conn) {
statement &statement_cache::acquire(query_context &&context, const connection &conn) {
std::lock_guard<std::mutex> guard(mutex_);
auto key = hash_(stmt);
auto key = hash_(context.sql);
auto it = statement_map_.find(key);
if (it == statement_map_.end()) {
cache_info info {conn.prepare(std::move(context)), 1};
// it = statement_map_.emplace(key, {conn.prepare(std::move(context))});
}
return *it->second.statement_;
return it->second.statement_;
}
void statement_cache::release(const statement &stmt) {