observer progress, added to schema and added schema_observer class
This commit is contained in:
@@ -3,11 +3,14 @@
|
||||
|
||||
#include "matador/sql/backend_provider.hpp"
|
||||
#include "matador/sql/connection.hpp"
|
||||
#include "matador/sql/connection_pool.hpp"
|
||||
#include "matador/sql/interface/connection_impl.hpp"
|
||||
|
||||
#include "matador/query/criteria_evaluator.hpp"
|
||||
#include "matador/query/query.hpp"
|
||||
#include "matador/query/column.hpp"
|
||||
#include "matador/query/table.hpp"
|
||||
#include "matador/query/schema.hpp"
|
||||
|
||||
#include "matador/orm/session_query_builder.hpp"
|
||||
|
||||
@@ -34,7 +37,9 @@ TEST_CASE("Create sql query data for entity with eager has one", "[query][entity
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<airplane>("airplanes")
|
||||
.and_then( [&scm] { return scm.attach<flight>("flights"); } );
|
||||
REQUIRE(result);
|
||||
@@ -82,7 +87,9 @@ TEST_CASE("Create sql query data for entity with eager belongs to", "[query][ent
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<author>("authors")
|
||||
.and_then( [&scm] { return scm.attach<book>("books"); } );
|
||||
REQUIRE(result);
|
||||
@@ -145,7 +152,9 @@ TEST_CASE("Create sql query data for entity with eager has many belongs to", "[q
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<product>("products")
|
||||
.and_then( [&scm] { return scm.attach<order_details>("order_details"); } )
|
||||
.and_then( [&scm] { return scm.attach<supplier>("suppliers"); } )
|
||||
@@ -206,10 +215,12 @@ TEST_CASE("Create sql query data for entity with eager many to many", "[query][e
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<recipe>("recipes")
|
||||
.and_then( [&scm] { return scm.attach<ingredient>("ingredients"); } );
|
||||
// .and_then( [&scm] { return scm.attach<recipe_ingredient>("recipe_ingredients"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
|
||||
@@ -254,10 +265,12 @@ TEST_CASE("Create sql query data for entity with eager many to many (inverse par
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<student>("students")
|
||||
.and_then( [&scm] { return scm.attach<course>("courses"); } );
|
||||
// .and_then( [&scm] { return scm.attach<student_course>("student_courses"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
|
||||
@@ -302,9 +315,12 @@ TEST_CASE("Test eager relationship", "[session][eager]") {
|
||||
using namespace matador::test;
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection db("noop://noop.db");
|
||||
repository scm("noop");
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema scm(pool);
|
||||
auto result = scm.attach<department>("departments")
|
||||
.and_then( [&scm] { return scm.attach<employee>("employees"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "matador/sql/backend_provider.hpp"
|
||||
#include "matador/sql/connection_pool.hpp"
|
||||
#include "matador/sql/interface/connection_impl.hpp"
|
||||
|
||||
#include "matador/query/generator.hpp"
|
||||
#include "matador/query/table.hpp"
|
||||
#include "matador/query/schema.hpp"
|
||||
|
||||
#include "matador/object/repository.hpp"
|
||||
|
||||
#include "../backend/test_backend_service.hpp"
|
||||
|
||||
#include "../test/models/product.hpp"
|
||||
#include "../test/models/order.hpp"
|
||||
#include "../test/models/book.hpp"
|
||||
@@ -12,10 +19,14 @@
|
||||
|
||||
using namespace matador::query;
|
||||
using namespace matador::object;
|
||||
using namespace matador::sql;
|
||||
|
||||
TEST_CASE("Generate columns from object", "[column][generator]") {
|
||||
using namespace matador::test;
|
||||
repository s("main");
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema s(pool);
|
||||
auto result = s.attach<product>("product");
|
||||
REQUIRE( result );
|
||||
|
||||
@@ -42,7 +53,10 @@ TEST_CASE("Generate columns from object", "[column][generator]") {
|
||||
|
||||
TEST_CASE("Generate columns for object with has many relation", "[column][generator][relation]") {
|
||||
using namespace matador::test;
|
||||
repository s("main");
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema s(pool);
|
||||
auto result = s.attach<supplier>("supplier")
|
||||
.and_then( [&s] { return s.attach<category>("categories"); } )
|
||||
.and_then( [&s] { return s.attach<order_details>("order_details"); } )
|
||||
@@ -82,7 +96,10 @@ TEST_CASE("Generate columns for object with has many relation", "[column][genera
|
||||
|
||||
TEST_CASE("Generate columns for object with eager foreign key relation", "[column][generator][eager]") {
|
||||
using namespace matador::test;
|
||||
repository s("main");
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
|
||||
schema s(pool);
|
||||
auto result = s.attach<book>("books")
|
||||
.and_then( [&s] { return s.attach<author>("authors"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
Reference in New Issue
Block a user