Fixed memory bug in handling text results in prepared statements.

This commit is contained in:
rbock
2017-03-12 12:04:00 +01:00
parent 862205d1bf
commit 26bdaf7eae

View File

@@ -40,11 +40,12 @@ namespace sqlpp
struct result_field_t<Db, field_spec_t<NameType, text, CanBeNull, NullIsTrivialValue>>
: public result_field_base<Db, field_spec_t<NameType, text, CanBeNull, NullIsTrivialValue>>
{
const char* text{nullptr}; // Non-owning
size_t len{};
template <typename Target>
void _bind(Target& target, size_t index)
{
const char* text{nullptr};
size_t len{};
target._bind_text_result(index, &text, &len);
if (text)
this->_value.assign(text, len);
@@ -56,8 +57,6 @@ namespace sqlpp
template <typename Target>
void _post_bind(Target& target, size_t index)
{
const char* text{nullptr};
size_t len{};
target._post_bind_text_result(index, &text, &len);
if (text)
this->_value.assign(text, len);