implemented lazy loading for object_ptr and belongs_to
This commit is contained in:
@@ -12,11 +12,8 @@
|
||||
#include "matador/query/table.hpp"
|
||||
#include "matador/query/schema.hpp"
|
||||
|
||||
#include "matador/utils/macro_map.hpp"
|
||||
#include "matador/query/query_builder.hpp"
|
||||
|
||||
#include "matador/orm/session_query_builder.hpp"
|
||||
|
||||
#include "../backend/test_connection.hpp"
|
||||
#include "../backend/test_backend_service.hpp"
|
||||
|
||||
#include "../../models/airplane.hpp"
|
||||
@@ -29,7 +26,6 @@
|
||||
#include "../../models/student.hpp"
|
||||
|
||||
using namespace matador::object;
|
||||
using namespace matador::orm;
|
||||
using namespace matador::query;
|
||||
using namespace matador::utils;
|
||||
using namespace matador::sql;
|
||||
@@ -46,7 +42,7 @@ TEST_CASE("Create sql query data for entity with eager has one", "[query][entity
|
||||
.and_then( [&scm] { return scm.attach<flight>("flights"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
const auto it = scm.find(typeid(flight));
|
||||
REQUIRE(it != scm.end());
|
||||
@@ -100,7 +96,7 @@ TEST_CASE("Create sql query data for entity with eager belongs to", "[query][ent
|
||||
.and_then( [&scm] { return scm.attach<book>("books"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
const auto it = scm.find(typeid(book));
|
||||
REQUIRE(it != scm.end());
|
||||
@@ -172,7 +168,7 @@ TEST_CASE("Create sql query data for entity with eager has many belongs to", "[q
|
||||
.and_then( [&scm] { return scm.attach<order>("orders"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
const auto it = scm.find(typeid(order));
|
||||
REQUIRE(it != scm.end());
|
||||
@@ -236,7 +232,7 @@ TEST_CASE("Create sql query data for entity with eager many to many", "[query][e
|
||||
.and_then( [&scm] { return scm.attach<ingredient>("ingredients"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
const auto it = scm.find(typeid(ingredient));
|
||||
REQUIRE(it != scm.end());
|
||||
@@ -290,7 +286,7 @@ TEST_CASE("Create sql query data for entity with eager many to many (inverse par
|
||||
.and_then( [&scm] { return scm.attach<course>("courses"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
const auto it = scm.find(typeid(course));
|
||||
REQUIRE(it != scm.end());
|
||||
@@ -344,7 +340,7 @@ TEST_CASE("Test eager relationship", "[session][eager]") {
|
||||
.and_then( [&scm] { return scm.attach<employee>("employees"); } );
|
||||
REQUIRE(result);
|
||||
|
||||
session_query_builder eqb(scm, db);
|
||||
query_builder eqb(scm, db);
|
||||
|
||||
auto data = eqb.build<department>();
|
||||
REQUIRE(data.is_ok());
|
||||
|
||||
Reference in New Issue
Block a user