removed condition classes, functions and operators
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "matador/sql/column.hpp"
|
||||
#include "matador/sql/table.hpp"
|
||||
|
||||
#include "matador/query/criteria_evaluator.hpp"
|
||||
#include "matador/query/query.hpp"
|
||||
|
||||
#include "matador/orm/session_query_builder.hpp"
|
||||
@@ -62,15 +63,16 @@ TEST_CASE("Create sql query data for entity with eager has one", "[query][entity
|
||||
|
||||
query_context qc;
|
||||
size_t index{0};
|
||||
for (const auto &jd : data->joins) {
|
||||
REQUIRE(jd.join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(jd.condition->evaluate(db.dialect(), qc) == expected_join_data[index].second);
|
||||
criteria_evaluator evaluator(db.dialect(), qc);
|
||||
for (const auto &[join_table, condition] : data->joins) {
|
||||
REQUIRE(join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(evaluator.evaluate(*condition) == expected_join_data[index].second);
|
||||
++index;
|
||||
}
|
||||
|
||||
REQUIRE(data->where_clause);
|
||||
auto cond = data->where_clause->evaluate(db.dialect(), qc);
|
||||
REQUIRE(cond == R"("t01"."id" = 17)");
|
||||
REQUIRE(data->where_clause.get());
|
||||
auto cond = evaluator.evaluate(*data->where_clause);
|
||||
REQUIRE(cond == R"("t01"."id" = ?)");
|
||||
}
|
||||
|
||||
TEST_CASE("Create sql query data for entity with eager belongs to", "[query][entity][builder]") {
|
||||
@@ -111,15 +113,16 @@ TEST_CASE("Create sql query data for entity with eager belongs to", "[query][ent
|
||||
|
||||
query_context qc;
|
||||
size_t index{0};
|
||||
criteria_evaluator evaluator(db.dialect(), qc);
|
||||
for (const auto &jd : data->joins) {
|
||||
REQUIRE(jd.join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(jd.condition->evaluate(db.dialect(), qc) == expected_join_data[index].second);
|
||||
REQUIRE(evaluator.evaluate(*jd.condition) == expected_join_data[index].second);
|
||||
++index;
|
||||
}
|
||||
|
||||
REQUIRE(data->where_clause);
|
||||
auto cond = data->where_clause->evaluate(db.dialect(), qc);
|
||||
REQUIRE(cond == R"("t01"."id" = 17)");
|
||||
REQUIRE(data->where_clause.get());
|
||||
auto cond = evaluator.evaluate(*data->where_clause);
|
||||
REQUIRE(cond == R"("t01"."id" = ?)");
|
||||
|
||||
auto q = matador::query::query::select(data->columns)
|
||||
.from(data->root_table->name);
|
||||
@@ -180,15 +183,16 @@ TEST_CASE("Create sql query data for entity with eager has many belongs to", "[q
|
||||
|
||||
query_context qc;
|
||||
size_t index{0};
|
||||
criteria_evaluator evaluator(db.dialect(), qc);
|
||||
for (const auto &jd : data->joins) {
|
||||
REQUIRE(jd.join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(jd.condition->evaluate(db.dialect(), qc) == expected_join_data[index].second);
|
||||
REQUIRE(evaluator.evaluate(*jd.condition) == expected_join_data[index].second);
|
||||
++index;
|
||||
}
|
||||
|
||||
REQUIRE(data->where_clause);
|
||||
auto cond = data->where_clause->evaluate(db.dialect(), qc);
|
||||
REQUIRE(cond == R"("t01"."order_id" = 17)");
|
||||
REQUIRE(data->where_clause.get());
|
||||
auto cond = evaluator.evaluate(*data->where_clause);
|
||||
REQUIRE(cond == R"("t01"."order_id" = ?)");
|
||||
}
|
||||
|
||||
TEST_CASE("Create sql query data for entity with eager many to many", "[query][entity][builder]") {
|
||||
@@ -225,15 +229,16 @@ TEST_CASE("Create sql query data for entity with eager many to many", "[query][e
|
||||
|
||||
query_context qc;
|
||||
size_t index{0};
|
||||
criteria_evaluator evaluator(db.dialect(), qc);
|
||||
for (const auto &jd : data->joins) {
|
||||
REQUIRE(jd.join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(jd.condition->evaluate(db.dialect(), qc) == expected_join_data[index].second);
|
||||
REQUIRE(evaluator.evaluate(*jd.condition) == expected_join_data[index].second);
|
||||
++index;
|
||||
}
|
||||
|
||||
REQUIRE(data->where_clause);
|
||||
auto cond = data->where_clause->evaluate(db.dialect(), qc);
|
||||
REQUIRE(cond == R"("t01"."id" = 17)");
|
||||
REQUIRE(data->where_clause.get());
|
||||
auto cond = evaluator.evaluate(*data->where_clause);
|
||||
REQUIRE(cond == R"("t01"."id" = ?)");
|
||||
}
|
||||
|
||||
TEST_CASE("Create sql query data for entity with eager many to many (inverse part)", "[query][entity][builder]") {
|
||||
@@ -270,15 +275,16 @@ TEST_CASE("Create sql query data for entity with eager many to many (inverse par
|
||||
|
||||
query_context qc;
|
||||
size_t index{0};
|
||||
criteria_evaluator evaluator(db.dialect(), qc);
|
||||
for (const auto &jd : data->joins) {
|
||||
REQUIRE(jd.join_table->name == expected_join_data[index].first);
|
||||
REQUIRE(jd.condition->evaluate(db.dialect(), qc) == expected_join_data[index].second);
|
||||
REQUIRE(evaluator.evaluate(*jd.condition) == expected_join_data[index].second);
|
||||
++index;
|
||||
}
|
||||
|
||||
REQUIRE(data->where_clause);
|
||||
auto cond = data->where_clause->evaluate(db.dialect(), qc);
|
||||
REQUIRE(cond == R"("t01"."id" = 17)");
|
||||
REQUIRE(data->where_clause.get());
|
||||
auto cond = evaluator.evaluate(*data->where_clause);
|
||||
REQUIRE(cond == R"("t01"."id" = ?)");
|
||||
}
|
||||
|
||||
TEST_CASE("Test eager relationship", "[session][eager]") {
|
||||
|
||||
Reference in New Issue
Block a user