added belongs to many eager test loading via sql join (progress)

This commit is contained in:
2025-02-17 22:16:03 +01:00
parent 5109659882
commit 901d9c071a
5 changed files with 64 additions and 15 deletions
+5 -5
View File
@@ -70,7 +70,7 @@ TEST_CASE("Create sql query data for entity with eager has one", "[query][entity
REQUIRE(data->where_clause);
auto cond = data->where_clause->evaluate(db.dialect(), qc);
REQUIRE(cond == R"("flights"."id" = 17)");
REQUIRE(cond == R"("t01"."id" = 17)");
}
TEST_CASE("Create sql query data for entity with eager belongs to", "[query][entity][builder]") {
@@ -119,7 +119,7 @@ TEST_CASE("Create sql query data for entity with eager belongs to", "[query][ent
REQUIRE(data->where_clause);
auto cond = data->where_clause->evaluate(db.dialect(), qc);
REQUIRE(cond == R"("books"."id" = 17)");
REQUIRE(cond == R"("t01"."id" = 17)");
auto q = matador::query::query::select(data->columns)
.from(data->root_table->name);
@@ -188,7 +188,7 @@ TEST_CASE("Create sql query data for entity with eager has many belongs to", "[q
REQUIRE(data->where_clause);
auto cond = data->where_clause->evaluate(db.dialect(), qc);
REQUIRE(cond == R"("orders"."order_id" = 17)");
REQUIRE(cond == R"("t01"."order_id" = 17)");
}
TEST_CASE("Create sql query data for entity with eager many to many", "[query][entity][builder]") {
@@ -233,7 +233,7 @@ TEST_CASE("Create sql query data for entity with eager many to many", "[query][e
REQUIRE(data->where_clause);
auto cond = data->where_clause->evaluate(db.dialect(), qc);
REQUIRE(cond == R"("ingredients"."id" = 17)");
REQUIRE(cond == R"("t01"."id" = 17)");
}
TEST_CASE("Create sql query data for entity with eager many to many (inverse part)", "[query][entity][builder]") {
@@ -278,7 +278,7 @@ TEST_CASE("Create sql query data for entity with eager many to many (inverse par
REQUIRE(data->where_clause);
auto cond = data->where_clause->evaluate(db.dialect(), qc);
REQUIRE(cond == R"("courses"."id" = 17)");
REQUIRE(cond == R"("t01"."id" = 17)");
}
TEST_CASE("Test eager relationship", "[session][eager]") {