progress on record fetch

This commit is contained in:
2023-11-20 07:15:53 +01:00
parent ae5777bdb0
commit 171e8d36ce
20 changed files with 174 additions and 63 deletions
+17 -7
View File
@@ -161,12 +161,13 @@ TEST_CASE("Execute select statement with where clause", "[session]") {
.execute();
REQUIRE(res.first == 1);
auto result = s.select<person>()
.from("person")
.where("id"_col == 7)
.fetch_all();
// fetch person as record
auto result_record = s.select<person>()
.from("person")
.where("id"_col == 7)
.fetch_all();
for (const auto& i : result) {
for (const auto& i : result_record) {
REQUIRE(i.size() == 3);
REQUIRE(i.at(0).name() == "id");
REQUIRE(i.at(0).type() == data_type_t::type_long_long);
@@ -179,10 +180,19 @@ TEST_CASE("Execute select statement with where clause", "[session]") {
REQUIRE(i.at(2).value<long long>() == george.age);
}
// REQUIRE(res.str() == R"(SELECT "id", "name", "color" FROM "person" WHERE "id" = 8)");
// fetch person as person
auto result_person = s.select<person>()
.from("person")
.where("id"_col == 7)
.fetch_all<person>();
for (const auto& i : result_person) {
REQUIRE(i.id == 7);
REQUIRE(i.name == "george");
REQUIRE(i.age == 45);
}
s.drop().table("person").execute();
}
TEST_CASE("Execute select statement with order by", "[session]") {