added date_type_t, time_type_t and timestamp, ensure allocated postgres resources are released, split repository into basic_repository and repository.
This commit is contained in:
@@ -428,8 +428,8 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship", "[query][join][many_to_many]") {
|
||||
auto result = repo.attach<recipe>("recipes")
|
||||
.and_then( [this] { return repo.attach<ingredient>("ingredients"); } );
|
||||
auto result = repo.attach<ingredient>("ingredients")
|
||||
.and_then( [this] { return repo.attach<recipe>("recipes"); } );
|
||||
|
||||
auto obj = object_generator::generate<recipe>(repo.repo(), "recipes");
|
||||
auto res = query::create()
|
||||
@@ -455,7 +455,10 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
|
||||
REQUIRE(db.exists("ingredients"));
|
||||
tables_to_drop.emplace("ingredients");
|
||||
|
||||
obj = object_generator::generate<recipe_ingredient>(repo.repo(), "recipe_ingredients");
|
||||
const auto it = repo.find("recipe_ingredients");
|
||||
REQUIRE(it != repo.end());
|
||||
obj = it->second.node().info().object();
|
||||
// obj = object_generator::generate<recipe_ingredient>(repo.repo(), "recipe_ingredients");
|
||||
res = query::create()
|
||||
.table(obj->name())
|
||||
.columns(obj->attributes())
|
||||
@@ -512,16 +515,17 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
|
||||
{ 9, 3 }
|
||||
};
|
||||
|
||||
using namespace matador::query::meta;
|
||||
|
||||
for (const auto & [recipe_id, ingredient_id]: recipe_ingredients) {
|
||||
res = query::insert()
|
||||
.into("recipe_ingredients", generator::columns<recipe_ingredient>(repo))
|
||||
.into("recipe_ingredients", RECIPE_INGREDIENT)
|
||||
.values({recipe_id, ingredient_id})
|
||||
.execute(db);
|
||||
REQUIRE(res.is_ok());
|
||||
REQUIRE(*res == 1);
|
||||
}
|
||||
|
||||
using namespace matador::query::meta;
|
||||
|
||||
const auto r = RECIPE.as("r");
|
||||
const auto ri= RECIPE_INGREDIENT.as("ri");
|
||||
|
||||
@@ -237,7 +237,7 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma
|
||||
|
||||
std::vector<std::unique_ptr<department>> departments;
|
||||
departments.emplace_back(new department{1, "Insurance", {}});
|
||||
departments.emplace_back(new department{ 2, "Invoice", {}});
|
||||
departments.emplace_back(new department{2, "Invoice", {}});
|
||||
|
||||
for (auto &&a: departments) {
|
||||
auto res = ses.insert(a.release());
|
||||
|
||||
Reference in New Issue
Block a user