renamed initialize_executor to initialize
This commit is contained in:
parent
d59b41d06c
commit
f62f3e626b
|
|
@ -87,7 +87,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] bool contains(const std::type_index &index) const;
|
[[nodiscard]] bool contains(const std::type_index &index) const;
|
||||||
|
|
||||||
void initialize_executor(sql::executor &exec) const;
|
void initialize(sql::executor &exec) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ bool basic_schema::contains(const std::type_index &index) const {
|
||||||
return schema_nodes_.count(index) == 1;
|
return schema_nodes_.count(index) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void basic_schema::initialize_executor(sql::executor &exec) const {
|
void basic_schema::initialize(sql::executor &exec) const {
|
||||||
auto factory = std::make_shared<sql::producer_resolver_factory>();
|
auto factory = std::make_shared<sql::producer_resolver_factory>();
|
||||||
for (const auto &[key, producer] : resolver_producers_) {
|
for (const auto &[key, producer] : resolver_producers_) {
|
||||||
auto resolver = producer->produce(exec);
|
auto resolver = producer->produce(exec);
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
|
||||||
.and_then([this] {return repo.create(db); });
|
.and_then([this] {return repo.create(db); });
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
|
|
||||||
REQUIRE(db.exists(AIRPLANE.table_name()));
|
REQUIRE(db.exists(AIRPLANE.table_name()));
|
||||||
REQUIRE(db.exists(FLIGHT.table_name()));
|
REQUIRE(db.exists(FLIGHT.table_name()));
|
||||||
|
|
@ -538,7 +538,7 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with eager has many relation",
|
||||||
.and_then([this] {return repo.create(db); });
|
.and_then([this] {return repo.create(db); });
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
|
|
||||||
const std::vector shipments {
|
const std::vector shipments {
|
||||||
make_object<shipment>(1, "4711"),
|
make_object<shipment>(1, "4711"),
|
||||||
|
|
@ -636,7 +636,7 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy has many relation", "
|
||||||
} );
|
} );
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
|
|
||||||
const std::vector authors {
|
const std::vector authors {
|
||||||
make_object<author>(1, "Michael", "Crichton", "23.10.1942", 1975, true),
|
make_object<author>(1, "Michael", "Crichton", "23.10.1942", 1975, true),
|
||||||
|
|
@ -718,7 +718,7 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy belongs to relation",
|
||||||
.and_then([this] {return repo.create(db); });
|
.and_then([this] {return repo.create(db); });
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
|
|
||||||
const std::vector deps {
|
const std::vector deps {
|
||||||
make_object<department>(1, "Human Resources"),
|
make_object<department>(1, "Human Resources"),
|
||||||
|
|
@ -864,7 +864,7 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with eager has many to many rel
|
||||||
|
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
|
|
||||||
REQUIRE(db.exists(RECIPE.table_name()));
|
REQUIRE(db.exists(RECIPE.table_name()));
|
||||||
REQUIRE(db.exists(INGREDIENT.table_name()));
|
REQUIRE(db.exists(INGREDIENT.table_name()));
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ TEST_CASE_METHOD(SessionFixture, "Test insert object with has many relation", "[
|
||||||
.and_then([this] { return schema.create(db); } );
|
.and_then([this] { return schema.create(db); } );
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
schema.initialize_executor(ses);
|
schema.initialize(ses);
|
||||||
|
|
||||||
auto s_king = make_object<author>(1, "Steven", "King", "21.9.1947", 1956, false);
|
auto s_king = make_object<author>(1, "Steven", "King", "21.9.1947", 1956, false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ TEST_CASE_METHOD(SessionFixture, "Session delete test", "[session][delete]") {
|
||||||
.and_then([this] { return schema.create(db); } );
|
.and_then([this] { return schema.create(db); } );
|
||||||
REQUIRE(res.is_ok());
|
REQUIRE(res.is_ok());
|
||||||
|
|
||||||
schema.initialize_executor(ses);
|
schema.initialize(ses);
|
||||||
|
|
||||||
auto result = ses.insert(make_object<airplane>(1, "Boeing", "A380"));
|
auto result = ses.insert(make_object<airplane>(1, "Boeing", "A380"));
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
@ -165,7 +165,7 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma
|
||||||
.and_then([this] { return schema.create(db); } );
|
.and_then([this] { return schema.create(db); } );
|
||||||
REQUIRE(result.is_ok());
|
REQUIRE(result.is_ok());
|
||||||
|
|
||||||
schema.initialize_executor(ses);
|
schema.initialize(ses);
|
||||||
std::vector authors {
|
std::vector authors {
|
||||||
make_object<author>(1, "Michael", "Crichton", "23.10.1942", 1975, true),
|
make_object<author>(1, "Michael", "Crichton", "23.10.1942", 1975, true),
|
||||||
make_object<author>( 2, "Steven", "King", "21.9.1947", 1956, false)
|
make_object<author>( 2, "Steven", "King", "21.9.1947", 1956, false)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public:
|
||||||
StatementTestFixture() {
|
StatementTestFixture() {
|
||||||
REQUIRE(repo.attach<airplane>("airplanes")
|
REQUIRE(repo.attach<airplane>("airplanes")
|
||||||
.and_then([this] {return repo.create(db); }));
|
.and_then([this] {return repo.create(db); }));
|
||||||
repo.initialize_executor(db);
|
repo.initialize(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue