From 8079015d2cfe78f3fb2d8965935b1470983576fb Mon Sep 17 00:00:00 2001 From: rbock Date: Fri, 26 Feb 2016 22:28:11 +0100 Subject: [PATCH] Removed where(true). --- include/sqlpp11/where.h | 99 +++-------------------------------------- 1 file changed, 5 insertions(+), 94 deletions(-) diff --git a/include/sqlpp11/where.h b/include/sqlpp11/where.h index 4327e3ff..fac903dd 100644 --- a/include/sqlpp11/where.h +++ b/include/sqlpp11/where.h @@ -154,70 +154,6 @@ namespace sqlpp }; }; -#ifdef SQLPP_ALLOW_NAKED_BOOL_EXPRESSION - template <> - struct where_data_t - { - bool _condition; - }; - - // WHERE(BOOL) - template <> - struct where_t - { - using _traits = make_traits; - using _nodes = detail::type_vector<>; - - // Data - using _data_t = where_data_t; - - // Member implementation with data and methods - template - struct _impl_t - { - // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269 - _impl_t() = default; - _impl_t(const _data_t& data) : _data(data) - { - } - - _data_t _data; - }; - - // Base template to be inherited by the statement - template - struct _base_t - { - using _data_t = where_data_t; - - // workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269 - template - _base_t(Args&&... args) - : where{std::forward(args)...} - { - } - - _impl_t where; - _impl_t& operator()() - { - return where; - } - const _impl_t& operator()() const - { - return where; - } - - template - static auto _get_member(T t) -> decltype(t.where) - { - return t.where; - } - - using _consistency_check = consistent_t; - }; - }; -#endif - template <> struct where_data_t { @@ -392,23 +328,14 @@ namespace sqlpp assert_where_t, consistent_t>::type; -#ifdef SQLPP_ALLOW_NAKED_BOOL_EXPRESSION template - auto where(bool b) const -> _new_statement_t> + auto where(bool) const -> bad_statement { - return {static_cast&>(*this), where_data_t{b}}; + static_assert(wrong_t::value, + ".where(bool) is not allowed any more. Please use unconditionally() to replace " + ".where(true). Use sqlpp::value(bool) if you really want to use a bool here"); + return {}; } -#else - template - auto where(bool b) const -> bad_statement - { - static_assert( - wrong_t::value, - "where(bool) is deprecated, please use unconditionally() or #define SQLPP_ALLOW_NAKED_BOOL_EXPRESSION " - "for a grace period"); - return {static_cast&>(*this), where_data_t{b}}; - } -#endif auto unconditionally() const -> _new_statement_t> { @@ -469,22 +396,6 @@ namespace sqlpp } }; -#ifdef SQLPP_ALLOW_NAKED_BOOL_EXPRESSION - template - struct serializer_t> - { - using _serialize_check = consistent_t; - using T = where_data_t; - - static Context& _(const T& t, Context& context) - { - if (not t._condition) - context << " WHERE NULL"; - return context; - } - }; -#endif - template struct serializer_t> {