std::string_view should also be assignable in prepared statements

This commit is contained in:
Matthijs Möhlmann
2023-04-02 19:21:06 +02:00
committed by Roland Bock
parent 9412851408
commit 38aba217d4
2 changed files with 32 additions and 0 deletions

View File

@@ -33,6 +33,10 @@
#include <sqlpp11/data_types/text/wrap_operand.h>
#include <sqlpp11/data_types/text/operand.h>
#if __cplusplus >= 201703L
#include <string_view>
#endif
namespace sqlpp
{
template <>
@@ -47,6 +51,22 @@ namespace sqlpp
{
target._bind_text_parameter(index, &_value, _is_null);
}
#if __cplusplus >= 201703L
parameter_value_base& operator=(const std::string_view& val)
{
_value = val;
_is_null = false;
return *this;
}
parameter_value_base& operator=(const char* val)
{
_value = val;
_is_null = false;
return *this;
}
#endif
};
} // namespace sqlpp
#endif