diff --git a/tests/MockDb.h b/tests/MockDb.h index 7d200eb1..567866d2 100644 --- a/tests/MockDb.h +++ b/tests/MockDb.h @@ -27,6 +27,7 @@ #define SQLPP_MOCK_DB_H #include +#include #include #include @@ -133,6 +134,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running execute call with\n" << context.str() << std::endl; } template @@ -140,6 +142,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running insert call with\n" << context.str() << std::endl; return 0; } @@ -148,6 +151,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running update call with\n" << context.str() << std::endl; return 0; } @@ -156,6 +160,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running remove call with\n" << context.str() << std::endl; return 0; } @@ -164,6 +169,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running select call with\n" << context.str() << std::endl; return {}; } @@ -195,6 +201,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running prepare execute call with\n" << context.str() << std::endl; return nullptr; } @@ -203,6 +210,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running prepare insert call with\n" << context.str() << std::endl; return nullptr; } @@ -222,6 +230,7 @@ struct MockDbT: public sqlpp::connection { _serializer_context_t context; ::sqlpp::serialize(x, context); + std::cout << "Running prepare select call with\n" << context.str() << std::endl; return nullptr; } diff --git a/tests/UnionTest.cpp b/tests/UnionTest.cpp index a5646c55..61436b7d 100644 --- a/tests/UnionTest.cpp +++ b/tests/UnionTest.cpp @@ -37,22 +37,12 @@ int main() test::TabBar t; test::TabFoo f; - auto u = select(t.alpha).from(t).union_distinct(select(f.epsilon).from(f)); + db(select(t.alpha).from(t).union_distinct(select(f.epsilon).from(f))); + db(select(t.alpha).from(t).union_all(select(f.epsilon).from(f))); - printer.reset(); - std::cerr << serialize(u, printer).str() << std::endl; + auto u = select(t.alpha).from(t).union_all(select(f.epsilon).from(f)).as(sqlpp::alias::u); - auto ua = select(t.alpha).from(t).union_all(select(f.epsilon).from(f)).as(sqlpp::alias::u); - - printer.reset(); - std::cerr << serialize(ua, printer).str() << std::endl; - - auto uu = select(all_of(ua)).from(ua).union_all(select(t.delta).from(t)); - - printer.reset(); - std::cerr << serialize(uu, printer).str() << std::endl; - - db(u); + db(select(all_of(u)).from(u).union_all(select(t.delta).from(t))); return 0; }