fixed session tests
This commit is contained in:
@@ -150,7 +150,10 @@ statement &statement::bind(const Type &obj) {
|
||||
template<class Type>
|
||||
utils::result<query_result<Type>, utils::error> statement::fetch() {
|
||||
return statement_proxy_->fetch(*bindings_).and_then([](std::unique_ptr<query_result_impl> &&value) {
|
||||
return utils::ok(query_result<Type>(std::forward<decltype(value)>(value)));
|
||||
const auto prototype = value->prototype();
|
||||
return utils::ok(query_result<Type>(std::forward<decltype(value)>(value), [prototype] {
|
||||
return detail::create_prototype<Type>(prototype);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -160,7 +163,10 @@ utils::result<std::unique_ptr<Type>, utils::error> statement::fetch_one() {
|
||||
if (!result.is_ok()) {
|
||||
return utils::failure(result.err());
|
||||
}
|
||||
auto records = query_result<Type>(result.release());
|
||||
const auto prototype = result.value()->prototype();
|
||||
auto records = query_result<Type>(result.release(), [prototype] {
|
||||
return detail::create_prototype<Type>(prototype);
|
||||
});
|
||||
auto first = records.begin();
|
||||
if (first == records.end()) {
|
||||
return utils::ok(std::unique_ptr<Type>{nullptr});
|
||||
|
||||
Reference in New Issue
Block a user