0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Fix blob result_type

This commit is contained in:
Philippe Daouadi 2018-03-07 10:28:10 +01:00 committed by rbock
parent 2e635cc963
commit 7b16f03aa0

View File

@ -40,7 +40,7 @@ namespace sqlpp
struct result_field_t<Db, field_spec_t<NameType, blob, CanBeNull, NullIsTrivialValue>> struct result_field_t<Db, field_spec_t<NameType, blob, CanBeNull, NullIsTrivialValue>>
: public result_field_base<Db, field_spec_t<NameType, blob, CanBeNull, NullIsTrivialValue>> : public result_field_base<Db, field_spec_t<NameType, blob, CanBeNull, NullIsTrivialValue>>
{ {
const char* blob{nullptr}; // Non-owning const uint8_t* blob{nullptr}; // Non-owning
size_t len{}; size_t len{};
template <typename Target> template <typename Target>
@ -48,9 +48,9 @@ namespace sqlpp
{ {
target._bind_blob_result(index, &blob, &len); target._bind_blob_result(index, &blob, &len);
if (blob) if (blob)
this->_value.assign(blob, len); this->_value.assign(blob, blob+len);
else else
this->_value.assign(""); this->_value.clear();
this->_is_null = (blob == nullptr); this->_is_null = (blob == nullptr);
} }
@ -59,9 +59,9 @@ namespace sqlpp
{ {
target._post_bind_blob_result(index, &blob, &len); target._post_bind_blob_result(index, &blob, &len);
if (blob) if (blob)
this->_value.assign(blob, len); this->_value.assign(blob, blob+len);
else else
this->_value.assign(""); this->_value.clear();
this->_is_null = (blob == nullptr); this->_is_null = (blob == nullptr);
} }
}; };