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

More defensive string construction in result set.

This commit is contained in:
rbock 2017-03-06 09:14:51 +01:00
parent f88efada67
commit 9145a3a4ee

View File

@ -46,7 +46,10 @@ namespace sqlpp
const char* text{nullptr}; const char* text{nullptr};
size_t len{}; size_t len{};
target._bind_text_result(index, &text, &len); target._bind_text_result(index, &text, &len);
if (text)
this->_value = {text, len}; this->_value = {text, len};
else
this->value = {};
this->_is_null = (text == nullptr); this->_is_null = (text == nullptr);
} }
@ -56,7 +59,10 @@ namespace sqlpp
const char* text{nullptr}; const char* text{nullptr};
size_t len{}; size_t len{};
target._post_bind_text_result(index, &text, &len); target._post_bind_text_result(index, &text, &len);
if (text)
this->_value = {text, len}; this->_value = {text, len};
else
this->value = {};
this->_is_null = (text == nullptr); this->_is_null = (text == nullptr);
} }
}; };