some improvements to select_query_builder and started insert_query_builder
This commit is contained in:
@@ -284,22 +284,31 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with many-to-m
|
||||
return schema.create(db);
|
||||
} );
|
||||
|
||||
std::vector<std::unique_ptr<ingredient>> ingredients;
|
||||
ingredients.push_back(std::make_unique<ingredient>(1, "Apple"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(2, "Strawberry"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(3, "Pineapple"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(4, "Sugar"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(5, "Flour"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(6, "Butter"));
|
||||
ingredients.push_back(std::make_unique<ingredient>(7, "Beans"));
|
||||
std::vector ingredients {
|
||||
object_ptr(std::make_shared<ingredient>(1, "Apple")),
|
||||
object_ptr(std::make_shared<ingredient>(2, "Strawberry")),
|
||||
object_ptr(std::make_shared<ingredient>(3, "Pineapple")),
|
||||
object_ptr(std::make_shared<ingredient>(4, "Sugar")),
|
||||
object_ptr(std::make_shared<ingredient>(5, "Flour")),
|
||||
object_ptr(std::make_shared<ingredient>(6, "Butter")),
|
||||
object_ptr(std::make_shared<ingredient>(7, "Beans"))
|
||||
};
|
||||
|
||||
for (auto &i: ingredients) {
|
||||
auto res = ses.insert(i.release());
|
||||
auto res = ses.insert(i);
|
||||
REQUIRE(res.is_ok());
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<recipe>> recipes;
|
||||
recipes.push_back(std::make_unique<recipe>(7, "Apple Crumble"));
|
||||
recipes.push_back(std::make_unique<recipe>(8, "Beans Chili"));
|
||||
recipes.push_back(std::make_unique<recipe>(9, "Fruit Salad"));
|
||||
std::vector recipes {
|
||||
object_ptr(std::make_shared<recipe>(1, "Apple Pie", std::vector{ingredients[0], ingredients[3], ingredients[4]})),
|
||||
object_ptr(std::make_shared<recipe>(2, "Strawberry Cake", std::vector{ingredients[5], ingredients[6]})),
|
||||
object_ptr(std::make_shared<recipe>(3, "Pineapple Pie", std::vector{ingredients[0], ingredients[1], ingredients[2]}))
|
||||
};
|
||||
|
||||
for (auto &r: recipes) {
|
||||
auto res = ses.insert(r);
|
||||
REQUIRE(res.is_ok());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user