added blob interface to backend binder classes

This commit is contained in:
Sascha Kuehl 2024-01-23 07:20:34 +01:00
parent 9509e56f3e
commit 9c8e402692
5 changed files with 19 additions and 1 deletions

View File

@ -54,6 +54,8 @@ public:
void bind(size_t pos, const std::string &string) override;
void bind(size_t pos, const std::string &x, size_t size) override;
void bind(size_t pos, const utils::blob &blob) override;
[[nodiscard]] std::vector<MYSQL_BIND>& bind_params();
private:

View File

@ -179,6 +179,11 @@ void mysql_parameter_binder::bind(size_t pos, const std::string &str, size_t siz
detail::bind_value(MYSQL_TYPE_VAR_STRING, str.data(), size, bind_params_[pos], is_null_vector[pos].is_null);
}
void mysql_parameter_binder::bind(size_t pos, const utils::blob &blob)
{
}
std::vector<MYSQL_BIND> &mysql_parameter_binder::bind_params()
{
return bind_params_;

View File

@ -30,6 +30,8 @@ public:
void bind(size_t pos, const std::string &string) override;
void bind(size_t pos, const std::string &x, size_t size) override;
void bind(size_t pos, const utils::blob &blob) override;
const std::vector<const char*>& params() const;
private:

View File

@ -2,13 +2,17 @@
#include "matador/sql/dialect_builder.hpp"
[[maybe_unused]] const matador::sql::dialect* get_dialect() {
[[maybe_unused]] const matador::sql::dialect *get_dialect()
{
using namespace matador::sql;
const static dialect d = dialect_builder::builder()
.create()
.with_placeholder_func([](size_t index) {
return "$" + std::to_string(index);
})
.with_data_type_replace_map({
{data_type_t::type_blob, "BYTEA"}
})
.with_default_schema_name("public")
.build();
return &d;

View File

@ -134,6 +134,11 @@ void postgres_parameter_binder::bind(size_t pos, const std::string &str, size_t
bind(pos, str);
}
void postgres_parameter_binder::bind(size_t pos, const utils::blob &blob)
{
}
const std::vector<const char *> &postgres_parameter_binder::params() const
{
return params_;