0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Replaced tag_yes and tag_no by std::true_type and std::false_type

This commit is contained in:
Roland Bock 2013-09-29 09:02:51 +02:00
parent 581353dc53
commit d0d5fd2969
37 changed files with 86 additions and 125 deletions

View File

@ -87,9 +87,9 @@ namespace sqlpp
{ {
struct _value_type: Expression::_value_type struct _value_type: Expression::_value_type
{ {
using _is_expression = tag_no; using _is_expression = std::false_type;
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
using _is_alias = tag_yes; using _is_alias = std::true_type;
}; };
using _name_t = typename AliasProvider::_name_t; using _name_t = typename AliasProvider::_name_t;

View File

@ -42,7 +42,7 @@ namespace sqlpp
struct _value_type: public Select::_value_type::_base_value_type struct _value_type: public Select::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -50,7 +50,7 @@ namespace sqlpp
using _prohibited_assignment_set = typename detail::make_set_if<ProhibitPredicate, typename Assignment::column_type...>::type; using _prohibited_assignment_set = typename detail::make_set_if<ProhibitPredicate, typename Assignment::column_type...>::type;
static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()"); static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()");
using _is_assignment_list = tag_yes; using _is_assignment_list = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public Expr::_value_type::_base_value_type struct _value_type: public Expr::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -60,9 +60,9 @@ namespace sqlpp
struct boolean struct boolean
{ {
using _base_value_type = boolean; using _base_value_type = boolean;
using _is_boolean = tag_yes; using _is_boolean = std::true_type;
using _is_value = tag_yes; using _is_value = std::true_type;
using _is_expression = tag_yes; using _is_expression = std::true_type;
struct plus_ struct plus_
{ {

View File

@ -44,9 +44,9 @@ namespace sqlpp
using _column_type = typename ColumnSpec::_column_type; using _column_type = typename ColumnSpec::_column_type;
struct _value_type: ColumnSpec::_value_type struct _value_type: ColumnSpec::_value_type
{ {
using _is_expression = tag_yes; using _is_expression = std::true_type;
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
using _is_alias = tag_no; using _is_alias = std::false_type;
}; };
using _name_t = typename ColumnSpec::_name_t; using _name_t = typename ColumnSpec::_name_t;

View File

@ -44,7 +44,7 @@ namespace sqlpp
struct _value_type: public First::_value_type::_base_value_type struct _value_type: public First::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public numeric struct _value_type: public numeric
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2013, Roland Bock
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SQLPP_DETAIL_TAG_H
#define SQLPP_DETAIL_TAG_H
namespace sqlpp
{
namespace detail
{
struct tag {};
}
using tag_yes = detail::tag;
using tag_no = void;
}
#endif

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public boolean struct _value_type: public boolean
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -37,7 +37,7 @@ namespace sqlpp
template<typename Lhs, typename Rhs> template<typename Lhs, typename Rhs>
struct assignment_t struct assignment_t
{ {
using _is_assignment = tag_yes; using _is_assignment = std::true_type;
using column_type = Lhs; using column_type = Lhs;
using value_type = Rhs; using value_type = Rhs;

View File

@ -39,7 +39,7 @@ namespace sqlpp
template<typename... TableOrJoin> template<typename... TableOrJoin>
struct from_t struct from_t
{ {
using _is_from = tag_yes; using _is_from = std::true_type;
// ensure one argument at least // ensure one argument at least
static_assert(sizeof...(TableOrJoin), "at least one table or join argument required in from"); static_assert(sizeof...(TableOrJoin), "at least one table or join argument required in from");
@ -67,8 +67,8 @@ namespace sqlpp
template<typename Db> template<typename Db>
struct dynamic_from_t struct dynamic_from_t
{ {
using _is_from = tag_yes; using _is_from = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
template<typename Table> template<typename Table>
void add(Table&& table) void add(Table&& table)

View File

@ -52,7 +52,7 @@ namespace sqlpp
using _valid_expressions = typename detail::make_set_if<is_expression_t, Expr...>::type; using _valid_expressions = typename detail::make_set_if<is_expression_t, Expr...>::type;
static_assert(_valid_expressions::size::value == sizeof...(Expr), "at least one argument is not an expression in group_by()"); static_assert(_valid_expressions::size::value == sizeof...(Expr), "at least one argument is not an expression in group_by()");
using _is_group_by = tag_yes; using _is_group_by = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -68,8 +68,8 @@ namespace sqlpp
template<typename Db> template<typename Db>
struct dynamic_group_by_t struct dynamic_group_by_t
{ {
using _is_group_by = tag_yes; using _is_group_by = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
template<typename Expr> template<typename Expr>
void add(Expr&& expr) void add(Expr&& expr)

View File

@ -41,7 +41,7 @@ namespace sqlpp
{ {
static_assert(is_expression_t<Expr>::value, "invalid expression argument in having()"); static_assert(is_expression_t<Expr>::value, "invalid expression argument in having()");
using _is_having = tag_yes; using _is_having = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -57,8 +57,8 @@ namespace sqlpp
struct dynamic_having_t struct dynamic_having_t
{ {
using _is_having = tag_yes; using _is_having = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
template<typename Expr> template<typename Expr>
void add(Expr&& expr) void add(Expr&& expr)

View File

@ -64,7 +64,7 @@ namespace sqlpp
using _prohibited_assignment_set = typename detail::make_set_if<ProhibitPredicate, typename Assignment::column_type...>::type; using _prohibited_assignment_set = typename detail::make_set_if<ProhibitPredicate, typename Assignment::column_type...>::type;
static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()"); static_assert(_prohibited_assignment_set::size::value == 0, "at least one assignment is prohibited by its column definition in set()");
using _is_insert_list = tag_yes; using _is_insert_list = std::true_type;
insert_list_t(Assignment... assignment): insert_list_t(Assignment... assignment):
_columns({assignment._lhs}...), _columns({assignment._lhs}...),

View File

@ -58,8 +58,8 @@ namespace sqlpp
static_assert(Lhs::_table_set::template is_disjunct_from<typename Rhs::_table_set>::value, "joined tables must not be identical"); static_assert(Lhs::_table_set::template is_disjunct_from<typename Rhs::_table_set>::value, "joined tables must not be identical");
using _is_table = typename std::conditional<is_noop<On>::value, using _is_table = typename std::conditional<is_noop<On>::value,
tag_no, std::false_type,
tag_yes>::type; std::true_type>::type;
using _table_set = typename std::conditional<is_noop<On>::value, using _table_set = typename std::conditional<is_noop<On>::value,
void, void,
typename Lhs::_table_set::template join<typename Rhs::_table_set>::type>::type; typename Lhs::_table_set::template join<typename Rhs::_table_set>::type>::type;

View File

@ -45,7 +45,7 @@ namespace sqlpp
struct _value_type: public Operand::_value_type::_base_value_type struct _value_type: public Operand::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -35,7 +35,7 @@ namespace sqlpp
{ {
struct limit_t struct limit_t
{ {
using _is_limit = tag_yes; using _is_limit = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -48,8 +48,8 @@ namespace sqlpp
struct dynamic_limit_t struct dynamic_limit_t
{ {
using _is_limit = tag_yes; using _is_limit = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
dynamic_limit_t(): dynamic_limit_t():
_limit(0) _limit(0)

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public Expr::_value_type::_base_value_type struct _value_type: public Expr::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public Expr::_value_type::_base_value_type struct _value_type: public Expr::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -48,9 +48,9 @@ namespace sqlpp
struct _value_type: public no_value_t struct _value_type: public no_value_t
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
using _is_multi_column = tag_yes; using _is_multi_column = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const

View File

@ -42,9 +42,9 @@ namespace sqlpp
struct numeric struct numeric
{ {
using _base_value_type = numeric; using _base_value_type = numeric;
using _is_numeric = tag_yes; using _is_numeric = std::true_type;
using _is_value = tag_yes; using _is_value = std::true_type;
using _is_expression = tag_yes; using _is_expression = std::true_type;
template<size_t index> template<size_t index>
struct _result_entry_t struct _result_entry_t

View File

@ -35,7 +35,7 @@ namespace sqlpp
{ {
struct offset_t struct offset_t
{ {
using _is_offset = tag_yes; using _is_offset = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -48,8 +48,8 @@ namespace sqlpp
struct dynamic_offset_t struct dynamic_offset_t
{ {
using _is_offset = tag_yes; using _is_offset = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
dynamic_offset_t(): dynamic_offset_t():
_offset(0) _offset(0)

View File

@ -49,7 +49,7 @@ namespace sqlpp
using _valid_expressions = typename detail::make_set_if<is_sort_order_t, OrderExpr...>::type; using _valid_expressions = typename detail::make_set_if<is_sort_order_t, OrderExpr...>::type;
static_assert(_valid_expressions::size::value == sizeof...(OrderExpr), "at least one argument is not a sort order expression in order_by()"); static_assert(_valid_expressions::size::value == sizeof...(OrderExpr), "at least one argument is not a sort order expression in order_by()");
using _is_order_by = tag_yes; using _is_order_by = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -64,8 +64,8 @@ namespace sqlpp
template<typename Db> template<typename Db>
struct dynamic_order_by_t struct dynamic_order_by_t
{ {
using _is_order_by = tag_yes; using _is_order_by = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
template<typename Expr> template<typename Expr>
void add(Expr&& expr) void add(Expr&& expr)

View File

@ -91,8 +91,8 @@ namespace sqlpp
static_assert(is_noop<Limit>::value or is_limit_t<Limit>::value, "invalid 'limit' arguments"); static_assert(is_noop<Limit>::value or is_limit_t<Limit>::value, "invalid 'limit' arguments");
static_assert(is_noop<Offset>::value or is_offset_t<Offset>::value, "invalid 'offset' arguments"); static_assert(is_noop<Offset>::value or is_offset_t<Offset>::value, "invalid 'offset' arguments");
using _is_select = tag_yes; using _is_select = std::true_type;
using _requires_braces = tag_yes; using _requires_braces = std::true_type;
template<typename FromT> template<typename FromT>
using set_from_t = select_t<Database, Flags, ExpressionList, FromT, Where, GroupBy, Having, OrderBy, Limit, Offset>; using set_from_t = select_t<Database, Flags, ExpressionList, FromT, Where, GroupBy, Having, OrderBy, Limit, Offset>;

View File

@ -65,15 +65,15 @@ namespace sqlpp
static_assert(not detail::has_duplicates<typename NamedExpr::_name_t...>::value, "at least one duplicate name detected"); static_assert(not detail::has_duplicates<typename NamedExpr::_name_t...>::value, "at least one duplicate name detected");
// declare this to be a select expression // declare this to be a select expression
using _is_select_expression_list = tag_yes; using _is_select_expression_list = std::true_type;
// provide type information for sub-selects that are used as expressions // provide type information for sub-selects that are used as expressions
struct _column_type {}; struct _column_type {};
struct _value_type: std::conditional<sizeof...(NamedExpr) == 1, typename detail::get_first_argument<NamedExpr...>::type::_value_type, no_value_t>::type struct _value_type: std::conditional<sizeof...(NamedExpr) == 1, typename detail::get_first_argument<NamedExpr...>::type::_value_type, no_value_t>::type
{ {
using _is_expression = typename std::conditional<sizeof...(NamedExpr) == 1, tag_yes, tag_no>::type; using _is_expression = typename std::conditional<sizeof...(NamedExpr) == 1, std::true_type, std::false_type>::type;
using _is_named_expression = typename std::conditional<sizeof...(NamedExpr) == 1, tag_yes, tag_no>::type; using _is_named_expression = typename std::conditional<sizeof...(NamedExpr) == 1, std::true_type, std::false_type>::type;
using _is_alias = tag_no; using _is_alias = std::false_type;
}; };
struct _no_name_t {}; struct _no_name_t {};
using _name_t = typename std::conditional<sizeof...(NamedExpr) == 1, typename detail::get_first_argument<NamedExpr...>::type::_name_t, _no_name_t>::type; using _name_t = typename std::conditional<sizeof...(NamedExpr) == 1, typename detail::get_first_argument<NamedExpr...>::type::_name_t, _no_name_t>::type;

View File

@ -41,7 +41,7 @@ namespace sqlpp
{ {
struct _value_type struct _value_type
{ {
using _is_select_flag = tag_yes; using _is_select_flag = std::true_type;
}; };
template<typename Db> template<typename Db>
@ -56,7 +56,7 @@ namespace sqlpp
{ {
struct _value_type struct _value_type
{ {
using _is_select_flag = tag_yes; using _is_select_flag = std::true_type;
}; };
template<typename Db> template<typename Db>
@ -71,7 +71,7 @@ namespace sqlpp
{ {
struct _value_type struct _value_type
{ {
using _is_select_flag = tag_yes; using _is_select_flag = std::true_type;
}; };
template<typename Db> template<typename Db>
@ -93,7 +93,7 @@ namespace sqlpp
using _valid_flags = typename detail::make_set_if<is_select_flag_t, Flag...>::type; using _valid_flags = typename detail::make_set_if<is_select_flag_t, Flag...>::type;
static_assert(_valid_flags::size::value == sizeof...(Flag), "at least one argument is not a select flag in select flag list"); static_assert(_valid_flags::size::value == sizeof...(Flag), "at least one argument is not a select flag in select flag list");
using _is_select_flag_list = tag_yes; using _is_select_flag_list = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const

View File

@ -42,7 +42,7 @@ namespace sqlpp
struct _value_type: public Select::_value_type::_base_value_type struct _value_type: public Select::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -38,7 +38,7 @@ namespace sqlpp
template<typename Expression, sort_type SortType> template<typename Expression, sort_type SortType>
struct sort_order_t struct sort_order_t
{ {
using _is_sort_order = tag_yes; using _is_sort_order = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const

View File

@ -41,7 +41,7 @@ namespace sqlpp
struct _value_type: public Expr::_value_type::_base_value_type struct _value_type: public Expr::_value_type::_base_value_type
{ {
using _is_named_expression = tag_yes; using _is_named_expression = std::true_type;
}; };
struct _name_t struct _name_t

View File

@ -46,7 +46,7 @@ namespace sqlpp
using _required_insert_columns = typename detail::make_set_if<require_insert_t, column_t<Table, ColumnSpec>...>::type; using _required_insert_columns = typename detail::make_set_if<require_insert_t, column_t<Table, ColumnSpec>...>::type;
using _all_of_t = std::tuple<column_t<Table, ColumnSpec>...>; using _all_of_t = std::tuple<column_t<Table, ColumnSpec>...>;
using _is_table = tag_yes; using _is_table = std::true_type;
template<typename T> template<typename T>
join_t<inner_join_t, Table, typename std::decay<T>::type> join(T&& t) join_t<inner_join_t, Table, typename std::decay<T>::type> join(T&& t)
@ -57,14 +57,14 @@ namespace sqlpp
template<typename AliasProvider> template<typename AliasProvider>
struct alias_t: public ColumnSpec::_name_t::template _member_t<column_t<AliasProvider, ColumnSpec>>... struct alias_t: public ColumnSpec::_name_t::template _member_t<column_t<AliasProvider, ColumnSpec>>...
{ {
using _is_table = tag_yes; using _is_table = std::true_type;
using _table_set = detail::set<alias_t>; using _table_set = detail::set<alias_t>;
struct _value_type: Table::_value_type struct _value_type: Table::_value_type
{ {
using _is_expression = tag_no; using _is_expression = std::false_type;
using _is_named_expression = copy_type_trait<Table, is_value_t>; using _is_named_expression = copy_type_trait<Table, is_value_t>;
using _is_alias = tag_yes; using _is_alias = std::true_type;
}; };
using _name_t = typename AliasProvider::_name_t; using _name_t = typename AliasProvider::_name_t;

View File

@ -43,9 +43,9 @@ namespace sqlpp
struct text struct text
{ {
using _base_value_type = text; using _base_value_type = text;
using _is_text = tag_yes; using _is_text = std::true_type;
using _is_value = tag_yes; using _is_value = std::true_type;
using _is_expression = tag_yes; using _is_expression = std::true_type;
template<size_t index> template<size_t index>
struct _result_entry_t struct _result_entry_t

View File

@ -27,8 +27,9 @@
#ifndef SQLPP_TYPE_TRAITS_H #ifndef SQLPP_TYPE_TRAITS_H
#define SQLPP_TYPE_TRAITS_H #define SQLPP_TYPE_TRAITS_H
#include <type_traits>
#include <sqlpp11/detail/wrap_operand.h> #include <sqlpp11/detail/wrap_operand.h>
#include <sqlpp11/detail/tag.h>
namespace sqlpp namespace sqlpp
{ {
#define SQLPP_IS_VALUE_TRAIT_GENERATOR(name) \ #define SQLPP_IS_VALUE_TRAIT_GENERATOR(name) \
@ -37,7 +38,7 @@ namespace sqlpp
template<typename T, typename Enable = void>\ template<typename T, typename Enable = void>\
struct is_##name##_impl: std::false_type {};\ struct is_##name##_impl: std::false_type {};\
template<typename T>\ template<typename T>\
struct is_##name##_impl<T, typename std::enable_if<std::is_same<typename T::_value_type::_is_##name, tag>::value>::type>: std::true_type {};\ struct is_##name##_impl<T, typename std::enable_if<std::is_same<typename T::_value_type::_is_##name, std::true_type>::value>::type>: std::true_type {};\
}\ }\
template<typename T>\ template<typename T>\
struct is_##name##_t: detail::is_##name##_impl<T> {}; struct is_##name##_t: detail::is_##name##_impl<T> {};
@ -48,7 +49,7 @@ namespace sqlpp
template<typename T, typename Enable = void>\ template<typename T, typename Enable = void>\
struct name##_impl: std::false_type {};\ struct name##_impl: std::false_type {};\
template<typename T>\ template<typename T>\
struct name##_impl<T, typename std::enable_if<std::is_same<typename T::_column_type::_##name, tag>::value>::type>: std::true_type {};\ struct name##_impl<T, typename std::enable_if<std::is_same<typename T::_column_type::_##name, std::true_type>::value>::type>: std::true_type {};\
}\ }\
template<typename T>\ template<typename T>\
struct name##_t: detail::name##_impl<T> {}; struct name##_t: detail::name##_impl<T> {};
@ -59,7 +60,7 @@ namespace sqlpp
template<typename T, typename Enable = void>\ template<typename T, typename Enable = void>\
struct name##_impl: std::false_type {};\ struct name##_impl: std::false_type {};\
template<typename T>\ template<typename T>\
struct name##_impl<T, typename std::enable_if<std::is_same<typename T::_##name, tag>::value>::type>: std::true_type {};\ struct name##_impl<T, typename std::enable_if<std::is_same<typename T::_##name, std::true_type>::value>::type>: std::true_type {};\
}\ }\
template<typename T>\ template<typename T>\
struct name##_t: detail::name##_impl<T> {}; struct name##_t: detail::name##_impl<T> {};
@ -70,7 +71,7 @@ namespace sqlpp
template<typename T, typename Enable = void>\ template<typename T, typename Enable = void>\
struct connector_##name##_impl: std::false_type {};\ struct connector_##name##_impl: std::false_type {};\
template<typename T>\ template<typename T>\
struct connector_##name##_impl<T, typename std::enable_if<std::is_same<typename T::_tags::_##name, tag>::value>::type>: std::true_type {};\ struct connector_##name##_impl<T, typename std::enable_if<std::is_same<typename T::_tags::_##name, std::true_type>::value>::type>: std::true_type {};\
}\ }\
template<typename T>\ template<typename T>\
struct connector_##name##_t: detail::connector_##name##_impl<T> {}; struct connector_##name##_t: detail::connector_##name##_impl<T> {};
@ -115,7 +116,7 @@ namespace sqlpp
SQLPP_CONNECTOR_TRAIT_GENERATOR(has_empty_list_insert); SQLPP_CONNECTOR_TRAIT_GENERATOR(has_empty_list_insert);
template<typename T, template<typename> class IsTag> template<typename T, template<typename> class IsTag>
using copy_type_trait = typename std::conditional<IsTag<T>::value, detail::tag, void>::type; using copy_type_trait = typename std::conditional<IsTag<T>::value, std::true_type, std::false_type>::type;
template<typename T, template<typename> class IsCorrectType> template<typename T, template<typename> class IsCorrectType>
struct operand_t struct operand_t

View File

@ -36,7 +36,7 @@ namespace sqlpp
template<typename... Table> template<typename... Table>
struct using_t struct using_t
{ {
using _is_using = tag_yes; using _is_using = std::true_type;
static_assert(sizeof...(Table), "at least one table argument required in using"); static_assert(sizeof...(Table), "at least one table argument required in using");

View File

@ -42,7 +42,7 @@ namespace sqlpp
{ {
static_assert(is_expression_t<Expr>::value, "invalid expression argument in where()"); static_assert(is_expression_t<Expr>::value, "invalid expression argument in where()");
using _is_where = tag_yes; using _is_where = std::true_type;
template<typename Db> template<typename Db>
void serialize(std::ostream& os, Db& db) const void serialize(std::ostream& os, Db& db) const
@ -58,8 +58,8 @@ namespace sqlpp
struct dynamic_where_t struct dynamic_where_t
{ {
using _is_where = tag_yes; using _is_where = std::true_type;
using _is_dynamic = tag_yes; using _is_dynamic = std::true_type;
template<typename Expr> template<typename Expr>
void add(Expr&& expr) void add(Expr&& expr)

View File

@ -277,7 +277,7 @@ int main()
static_assert(sqlpp::is_select_flag_t<decltype(sqlpp::all)>::value, "sqlpp::all has to be a select_flag"); static_assert(sqlpp::is_select_flag_t<decltype(sqlpp::all)>::value, "sqlpp::all has to be a select_flag");
using T = sqlpp::detail::wrap_operand<int>::type; using T = sqlpp::detail::wrap_operand<int>::type;
static_assert(T::_is_expression, "T has to be an expression"); static_assert(T::_is_expression, "T has to be an expression");
static_assert(std::is_same<typename T::_value_type::_is_numeric, sqlpp::detail::tag>::value, "T has to be a numeric"); static_assert(std::is_same<typename T::_value_type::_is_numeric, std::true_type>::value, "T has to be a numeric");
static_assert(sqlpp::is_numeric_t<T>::value, "T has to be a numeric"); static_assert(sqlpp::is_numeric_t<T>::value, "T has to be a numeric");
static_assert(sqlpp::is_numeric_t<decltype(t.alpha)>::value, "TabSample.alpha has to be a numeric"); static_assert(sqlpp::is_numeric_t<decltype(t.alpha)>::value, "TabSample.alpha has to be a numeric");
((t.alpha + 7) + 4).asc(); ((t.alpha + 7) + 4).asc();
@ -291,7 +291,7 @@ int main()
static_assert(sqlpp::must_not_insert_t<decltype(t.alpha)>::value, "alpha must not be inserted"); static_assert(sqlpp::must_not_insert_t<decltype(t.alpha)>::value, "alpha must not be inserted");
t.alpha.serialize(std::cerr, db); t.alpha.serialize(std::cerr, db);
std::cerr << "\n" << sizeof(TabSample) << std::endl; std::cerr << "\n" << sizeof(TabSample) << std::endl;
static_assert(std::is_same<typename decltype(t.alpha)::_value_type::_is_named_expression, sqlpp::detail::tag>::value, "alpha should be a named expression"); static_assert(std::is_same<typename decltype(t.alpha)::_value_type::_is_named_expression, std::true_type>::value, "alpha should be a named expression");
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha)>::value, "alpha should be a named expression"); static_assert(sqlpp::is_named_expression_t<decltype(t.alpha)>::value, "alpha should be a named expression");
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be a named expression"); static_assert(sqlpp::is_named_expression_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be a named expression");
static_assert(sqlpp::is_alias_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be an alias"); static_assert(sqlpp::is_alias_t<decltype(t.alpha.as(sqlpp::alias::a))>::value, "an alias of alpha should be an alias");

View File

@ -89,10 +89,10 @@ namespace TabSample_
using _value_type = sqlpp::bigint; using _value_type = sqlpp::bigint;
struct _column_type struct _column_type
{ {
using _must_not_insert = sqlpp::tag_yes; using _must_not_insert = std::true_type;
using _must_not_update = sqlpp::tag_yes; using _must_not_update = std::true_type;
using _can_be_null = sqlpp::tag_yes; using _can_be_null = std::true_type;
using _trivial_value_is_null = sqlpp::tag_yes; using _trivial_value_is_null = std::true_type;
using _foreign_key = decltype(TabFoo::omega); using _foreign_key = decltype(TabFoo::omega);
}; };
}; };
@ -111,9 +111,9 @@ namespace TabSample_
using _value_type = sqlpp::varchar; using _value_type = sqlpp::varchar;
struct _column_type struct _column_type
{ {
using _can_be_null = sqlpp::tag_yes; using _can_be_null = std::true_type;
using _trivial_value_is_null = sqlpp::tag_yes; using _trivial_value_is_null = std::true_type;
using _must_not_update = sqlpp::tag_yes; using _must_not_update = std::true_type;
}; };
}; };
@ -131,7 +131,7 @@ namespace TabSample_
using _value_type = sqlpp::boolean; using _value_type = sqlpp::boolean;
struct _column_type struct _column_type
{ {
using _require_insert = sqlpp::tag_yes; using _require_insert = std::true_type;
}; };
}; };
} }