query select changes

This commit is contained in:
Sascha Kühl
2024-03-26 16:05:04 +01:00
parent b15b8da31f
commit 4a04a678f9
9 changed files with 193 additions and 32 deletions
+8 -2
View File
@@ -14,10 +14,16 @@ query_result<record> query_select_finish::fetch_all()
return connection_.fetch(compiler.compile(&data_));
}
record query_select_finish::fetch_one()
std::optional<record> query_select_finish::fetch_one()
{
query_compiler compiler(connection_.dialect());
return *connection_.fetch(compiler.compile(&data_)).begin().get();
auto result = connection_.fetch(compiler.compile(&data_));
auto first = result.begin();
if (first == result.end()) {
return std::nullopt;
}
return *first.get();
}
query_context query_select_finish::build() const