diff --git a/include/sqlpp11/policy_update.h b/include/sqlpp11/policy_update.h index b1cafabc..70070e13 100644 --- a/include/sqlpp11/policy_update.h +++ b/include/sqlpp11/policy_update.h @@ -27,7 +27,6 @@ #ifndef SQLPP_POLICY_UPDATE_H #define SQLPP_POLICY_UPDATE_H -#include #include namespace sqlpp diff --git a/include/sqlpp11/pre_join.h b/include/sqlpp11/pre_join.h index d0c68070..86b84c92 100644 --- a/include/sqlpp11/pre_join.h +++ b/include/sqlpp11/pre_join.h @@ -27,7 +27,6 @@ #ifndef SQLPP_PRE_JOIN_H #define SQLPP_PRE_JOIN_H -#include #include #include #include @@ -144,18 +143,38 @@ namespace sqlpp } }; - template - auto join(Lhs lhs, Rhs rhs) -> typename std:: - conditional::value, pre_join_t, bad_statement>::type + namespace detail { - check_pre_join_t{}; // FIXME: Failure return type? + template + auto join_impl(Check, Lhs lhs, Rhs rhs) -> Check; + template + auto join_impl(consistent_t, Lhs lhs, Rhs rhs) -> pre_join_t; + + template + auto join_impl(Lhs lhs, Rhs rhs) -> decltype(join_impl(check_pre_join_t{}, lhs, rhs)); + } + + template + auto join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl(lhs, rhs)) + { return {lhs, rhs}; } template - auto inner_join(Lhs lhs, Rhs rhs) -> typename std:: - conditional::value, pre_join_t, bad_statement>::type + auto inner_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl(lhs, rhs)) + { + return {lhs, rhs}; + } + + template + auto left_outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl(lhs, rhs)) + { + return {lhs, rhs}; + } + + template + auto right_outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl(lhs, rhs)) { check_pre_join_t{}; @@ -163,40 +182,27 @@ namespace sqlpp } template - auto left_outer_join(Lhs lhs, Rhs rhs) -> typename std:: - conditional::value, pre_join_t, bad_statement>::type + auto outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl(lhs, rhs)) { - check_pre_join_t{}; - return {lhs, rhs}; } - template - auto right_outer_join(Lhs lhs, Rhs rhs) -> typename std:: - conditional::value, pre_join_t, bad_statement>::type + namespace detail { - check_pre_join_t{}; + template + auto cross_join_impl(Check, Lhs lhs, Rhs rhs) -> Check; - return {lhs, rhs}; + template + auto cross_join_impl(consistent_t, Lhs lhs, Rhs rhs) + -> join_t, on_t>; + + template + auto cross_join_impl(Lhs lhs, Rhs rhs) -> decltype(cross_join_impl(check_pre_join_t{}, lhs, rhs)); } template - auto outer_join(Lhs lhs, Rhs rhs) -> typename std:: - conditional::value, pre_join_t, bad_statement>::type + auto cross_join(Lhs lhs, Rhs rhs) -> decltype(detail::cross_join_impl(lhs, rhs)) { - check_pre_join_t{}; - - return {lhs, rhs}; - } - - template - auto cross_join(Lhs lhs, Rhs rhs) -> - typename std::conditional::value, - join_t, on_t>, - bad_statement>::type - { - check_pre_join_t{}; - return {pre_join_t{lhs, rhs}, {}}; } } diff --git a/include/sqlpp11/union.h b/include/sqlpp11/union.h index 49dd128e..80070abd 100644 --- a/include/sqlpp11/union.h +++ b/include/sqlpp11/union.h @@ -27,16 +27,16 @@ #ifndef SQLPP_UNION_H #define SQLPP_UNION_H -#include -#include -#include -#include -#include #include #include #include -#include #include +#include +#include +#include +#include +#include +#include namespace sqlpp { @@ -45,19 +45,19 @@ namespace sqlpp using blank_union_t = statement_t; // There is no order by or limit or offset in union, use it as a pseudo table to do that. - template + template struct union_statement_impl + { + using type = Check; + }; + + template + struct union_statement_impl { using type = statement_t; }; - template - struct union_statement_impl - { - using type = bad_statement; - }; - - template + template using union_statement_t = typename union_statement_impl::type; // UNION(EXPR) @@ -95,8 +95,7 @@ namespace sqlpp // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269 template - _base_t(Args&&... args) - : union_{std::forward(args)...} + _base_t(Args&&... args) : union_{std::forward(args)...} { } @@ -166,8 +165,7 @@ namespace sqlpp // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269 template - _base_t(Args&&... args) - : no_union{std::forward(args)...} + _base_t(Args&&... args) : no_union{std::forward(args)...} { } @@ -196,7 +194,7 @@ namespace sqlpp using _check = typename logic::all::value...>::type; template - using _new_statement_t = union_statement_t; + using _new_statement_t = union_statement_t; using _consistency_check = consistent_t; @@ -237,16 +235,15 @@ namespace sqlpp } private: - template - auto _union_impl(const std::false_type&, Rhs rhs) const -> bad_statement; + template + auto _union_impl(Check, Rhs rhs) const -> Check; template - auto _union_impl(const std::true_type&, Rhs rhs) const - -> _new_statement_t, Rhs>> + auto _union_impl(consistent_t, Rhs rhs) const + -> _new_statement_t, Rhs>> { - return {blank_union_t{}, - union_data_t, Rhs>{ - static_cast&>(*this), rhs}}; + return {blank_union_t{}, union_data_t, Rhs>{ + static_cast&>(*this), rhs}}; } }; }; diff --git a/test_static_asserts/aggregates.cpp b/test_static_asserts/aggregates.cpp index ba458fe6..5566c00d 100644 --- a/test_static_asserts/aggregates.cpp +++ b/test_static_asserts/aggregates.cpp @@ -23,104 +23,95 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include "Sample.h" #include "MockDb.h" +#include "Sample.h" +#include #include -#include -#include #include - -namespace sqlpp -{ - namespace test - { - template - void print_type_on_error(std::true_type, const T&) - { - } - - template - void print_type_on_error(std::false_type, const T& t) - { - t._print_me_; - } - - template - void run_check(const Expression&) - { - using Context = MockDb::_serializer_context_t; - using CheckResult = std::is_same, Assert>; - static_assert(CheckResult::value, "Unexpected run_check result"); - print_type_on_error(CheckResult{}, sqlpp::run_check_t{}); - } - - template - void run_check(const Expression&) - { - using Context = MockDb::_serializer_context_t; - using CheckResult = std::is_same, consistent_t>; - static_assert(CheckResult::value, "Unexpected run_check result"); - print_type_on_error(CheckResult{}, sqlpp::run_check_t{}); - } - } -} +#include +#include namespace { + template + void print_type_on_error(std::true_type) + { + } + + template + void print_type_on_error(std::false_type) + { + T::_print_me_; + } + + template + void static_run_check(const Expression&) + { + using Context = MockDb::_serializer_context_t; + using CheckResult = sqlpp::run_check_t; + using ExpectedCheckResult = std::is_same; + print_type_on_error(ExpectedCheckResult{}); + static_assert(ExpectedCheckResult::value, "Unexpected check result"); + } + SQLPP_ALIAS_PROVIDER(whatever) - using sqlpp::test::run_check; static constexpr auto t = test::TabBar{}; // If there is no group_by, we can select whatever we want void no_group_by() { - run_check(select(all_of(t)).from(t).unconditionally()); - run_check(select(t.alpha).from(t).unconditionally()); - run_check(select(count(t.alpha)).from(t).unconditionally()); + static_run_check(select(all_of(t)).from(t).unconditionally()); + static_run_check(select(t.alpha).from(t).unconditionally()); + static_run_check(select(count(t.alpha)).from(t).unconditionally()); } // If there is a dynamic group_by, we can still select whatever we want // because there is no way of knowing which expressions might have been added dynamically void dynamic_group_by() { - run_check(select(all_of(t)).from(t).unconditionally()); - run_check(select(t.alpha).from(t).unconditionally()); - run_check(select(count(t.alpha)).from(t).unconditionally()); + static_run_check(select(all_of(t)).from(t).unconditionally()); + static_run_check(select(t.alpha).from(t).unconditionally()); + static_run_check(select(count(t.alpha)).from(t).unconditionally()); } // If there is a static group_by, selected columns must be made of group_by expressions, or aggregate expression (e.g. // count(t.id)) or values to be valid void static_group_by_ok() { - run_check(select(t.alpha).from(t).unconditionally().group_by(t.alpha)); - run_check(select((t.alpha + 42).as(whatever)).from(t).unconditionally().group_by(t.alpha)); - run_check(select((t.alpha + 42).as(whatever)).from(t).unconditionally().group_by(t.alpha, t.alpha + t.delta * 17)); - run_check(select((t.alpha + t.delta * 17).as(whatever)) - .from(t) - .unconditionally() - .group_by(t.alpha, t.alpha + t.delta * 17)); - run_check(select((t.beta + "fortytwo").as(whatever)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(t.alpha).from(t).unconditionally().group_by(t.alpha)); + static_run_check( + select((t.alpha + 42).as(whatever)).from(t).unconditionally().group_by(t.alpha)); + static_run_check( + select((t.alpha + 42).as(whatever)).from(t).unconditionally().group_by(t.alpha, t.alpha + t.delta * 17)); + static_run_check(select((t.alpha + t.delta * 17).as(whatever)) + .from(t) + .unconditionally() + .group_by(t.alpha, t.alpha + t.delta * 17)); + static_run_check( + select((t.beta + "fortytwo").as(whatever)).from(t).unconditionally().group_by(t.beta)); - run_check(select(avg(t.alpha)).from(t).unconditionally().group_by(t.beta)); - run_check(select(count(t.alpha)).from(t).unconditionally().group_by(t.beta)); - run_check(select(max(t.alpha)).from(t).unconditionally().group_by(t.beta)); - run_check(select(min(t.alpha)).from(t).unconditionally().group_by(t.beta)); - run_check(select(sum(t.alpha)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(avg(t.alpha)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(count(t.alpha)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(max(t.alpha)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(min(t.alpha)).from(t).unconditionally().group_by(t.beta)); + static_run_check(select(sum(t.alpha)).from(t).unconditionally().group_by(t.beta)); - run_check(select((t.alpha + count(t.delta)).as(whatever)).from(t).unconditionally().group_by(t.alpha)); + static_run_check( + select((t.alpha + count(t.delta)).as(whatever)).from(t).unconditionally().group_by(t.alpha)); - run_check(select(sqlpp::value(1).as(whatever)).from(t).unconditionally().group_by(t.alpha)); - run_check(select(sqlpp::value("whatever").as(whatever)).from(t).unconditionally().group_by(t.alpha)); + static_run_check( + select(sqlpp::value(1).as(whatever)).from(t).unconditionally().group_by(t.alpha)); + static_run_check( + select(sqlpp::value("whatever").as(whatever)).from(t).unconditionally().group_by(t.alpha)); } // Failures with static group_by and selected non-aggregates or incorrect aggregates void static_group_by_nok() { - run_check(select(t.beta).from(t).unconditionally().group_by(t.alpha)); - run_check( + static_run_check(select(t.beta).from(t).unconditionally().group_by(t.alpha)); + static_run_check( select((t.alpha + t.delta).as(whatever)).from(t).unconditionally().group_by(t.alpha)); - run_check( + static_run_check( select((t.alpha + t.delta).as(whatever)).from(t).unconditionally().group_by(t.alpha, t.alpha + t.delta * 17)); } } diff --git a/test_static_asserts/case.cpp b/test_static_asserts/case.cpp index 44506abb..d3d0eb6b 100644 --- a/test_static_asserts/case.cpp +++ b/test_static_asserts/case.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2015, Roland Bock + * Copyright (c) 2015-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -52,7 +52,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(sqlpp::case_when(when)); - using ExpectedReturnType = sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -66,7 +66,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(sqlpp::case_when(when).then(then)); - using ExpectedReturnType = sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -80,7 +80,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(sqlpp::case_when(when).then(then).else_(else_)); - using ExpectedReturnType = sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/test_static_asserts/from.cpp b/test_static_asserts/from.cpp index 53fc9231..c4acab06 100644 --- a/test_static_asserts/from.cpp +++ b/test_static_asserts/from.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -53,8 +53,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(select(t.alpha).from(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -69,8 +68,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(dynamic_select(db, t.alpha).dynamic_from(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -120,8 +118,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(from.add(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/test_static_asserts/having.cpp b/test_static_asserts/having.cpp index b4998275..d7d9bc1b 100644 --- a/test_static_asserts/having.cpp +++ b/test_static_asserts/having.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -53,8 +53,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(select(all_of(t)).from(t).unconditionally().group_by(t.alpha).having(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -70,8 +69,7 @@ namespace using ReturnType = decltype(dynamic_select(db, all_of(t)).from(t).unconditionally().group_by(t.alpha).dynamic_having(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -140,7 +138,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(select(all_of(t)).from(t).dynamic_having()); - using ExpectedReturnType = std::is_same; + using ExpectedReturnType = std::is_same; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/test_static_asserts/insert.cpp b/test_static_asserts/insert.cpp index 9a37014b..6df6d5c8 100644 --- a/test_static_asserts/insert.cpp +++ b/test_static_asserts/insert.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2015, Roland Bock + * Copyright (c) 2015-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -53,8 +53,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(insert_into(t).set(assignments...)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -69,8 +68,7 @@ namespace print_type_on_error(ExpectedCheckResult{}); using ReturnType = decltype(dynamic_insert_into(db, t).dynamic_set(assignments...)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; static_assert(ExpectedReturnType::value, "Unexpected return type"); print_type_on_error(ExpectedReturnType{}); } @@ -162,7 +160,7 @@ namespace print_type_on_error(ExpectedCheckResult{}); using ReturnType = decltype(insert_into(t).dynamic_set()); - using ExpectedReturnType = std::is_same; + using ExpectedReturnType = std::is_same; static_assert(ExpectedReturnType::value, "Unexpected return type"); print_type_on_error(ExpectedReturnType{}); } diff --git a/test_static_asserts/join.cpp b/test_static_asserts/join.cpp index e25fef2d..2c4117ea 100644 --- a/test_static_asserts/join.cpp +++ b/test_static_asserts/join.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -62,12 +62,9 @@ namespace (Assert::value and sqlpp::is_pre_join_t::value and sqlpp::is_pre_join_t::value and sqlpp::is_pre_join_t::value and sqlpp::is_pre_join_t::value and sqlpp::is_pre_join_t::value and sqlpp::is_join_t::value) xor - (std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value)>; + (std::is_same::value and std::is_same::value and + std::is_same::value and std::is_same::value and + std::is_same::value and std::is_same::value)>; print_type_on_error(ExpectedReturnType{}); print_type_on_error(ExpectedReturnType{}); print_type_on_error(ExpectedReturnType{}); @@ -87,7 +84,7 @@ namespace using ResultType = decltype(lhs.on(rhs)); using ExpectedReturnType = sqlpp::logic::all_t<(Assert::value and sqlpp::is_join_t::value) xor - std::is_same::value>; + std::is_same::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -190,18 +187,15 @@ namespace using RightOuterJoinType = decltype(sqlpp::dynamic_right_outer_join(table)); using OuterJoinType = decltype(sqlpp::dynamic_outer_join(table)); using CrossJoinType = decltype(sqlpp::dynamic_cross_join(table)); - using ExpectedReturnType = sqlpp::logic::all_t<(Assert::value and sqlpp::is_dynamic_pre_join_t::value and - sqlpp::is_dynamic_pre_join_t::value and - sqlpp::is_dynamic_pre_join_t::value and - sqlpp::is_dynamic_pre_join_t::value and - sqlpp::is_dynamic_pre_join_t::value and - sqlpp::is_dynamic_join_t::value) xor - (std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value and - std::is_same::value)>; + using ExpectedReturnType = sqlpp::logic::all_t< + (Assert::value and sqlpp::is_dynamic_pre_join_t::value and + sqlpp::is_dynamic_pre_join_t::value and + sqlpp::is_dynamic_pre_join_t::value and + sqlpp::is_dynamic_pre_join_t::value and + sqlpp::is_dynamic_pre_join_t::value and sqlpp::is_dynamic_join_t::value) xor + (std::is_same::value and std::is_same::value and + std::is_same::value and std::is_same::value and + std::is_same::value and std::is_same::value)>; print_type_on_error(ExpectedReturnType{}); print_type_on_error(ExpectedReturnType{}); print_type_on_error(ExpectedReturnType{}); @@ -221,7 +215,7 @@ namespace using ResultType = decltype(lhs.on(rhs)); using ExpectedReturnType = sqlpp::logic::all_t<(Assert::value and sqlpp::is_dynamic_join_t::value) xor - std::is_same::value>; + std::is_same::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/test_static_asserts/unwrapped_bool.cpp b/test_static_asserts/unwrapped_bool.cpp index 431a5ea8..fe190c75 100644 --- a/test_static_asserts/unwrapped_bool.cpp +++ b/test_static_asserts/unwrapped_bool.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -82,8 +82,7 @@ namespace void where_check(const Condition& condition) { using ReturnType = decltype(sqlpp::where(condition)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -104,7 +103,7 @@ namespace void where() { where_check(t.gamma); - where_check(true); + where_check(true); } } diff --git a/test_static_asserts/update_list.cpp b/test_static_asserts/update_list.cpp index 06838013..56cb666f 100644 --- a/test_static_asserts/update_list.cpp +++ b/test_static_asserts/update_list.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -53,8 +53,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(update(t).set(expressions...)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -69,8 +68,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(dynamic_update(db, t).dynamic_set(expressions...)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -127,7 +125,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(update(t).dynamic_set()); - using ExpectedReturnType = std::is_same; + using ExpectedReturnType = std::is_same; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/test_static_asserts/where.cpp b/test_static_asserts/where.cpp index d232adff..360a782c 100644 --- a/test_static_asserts/where.cpp +++ b/test_static_asserts/where.cpp @@ -23,9 +23,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include "MockDb.h" #include "Sample.h" +#include #include namespace @@ -52,8 +52,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(remove_from(t).where(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -68,8 +67,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(dynamic_remove_from(db, t).dynamic_where(expression)); - using ExpectedReturnType = - sqlpp::logic::all_t::value>; + using ExpectedReturnType = sqlpp::logic::all_t::value>; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } @@ -140,7 +138,7 @@ namespace static_assert(ExpectedCheckResult::value, "Unexpected check result"); using ReturnType = decltype(remove_from(t).dynamic_where()); - using ExpectedReturnType = std::is_same; + using ExpectedReturnType = std::is_same; print_type_on_error(ExpectedReturnType{}); static_assert(ExpectedReturnType::value, "Unexpected return type"); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 39fbad16..de3f952b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,14 +36,14 @@ set(test_names #Interpret #Insert #Remove - Update + #Update #Select #SelectType #Function #Prepared #Minimalistic #Result - #Union + Union #With )