mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Ok, the first few lines of test code compile again.
This commit is contained in:
parent
d062c1a0d8
commit
1d905e1db5
@ -28,13 +28,15 @@
|
|||||||
#define SQLPP_ALIAS_H
|
#define SQLPP_ALIAS_H
|
||||||
|
|
||||||
#include <sqlpp11/type_traits.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
|
#include <sqlpp11/vendor/serializer.h>
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
template<typename Expression, typename AliasProvider>
|
template<typename Expression, typename AliasProvider>
|
||||||
struct expression_alias_t
|
struct expression_alias_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expression>, tag::named_expression>;
|
using _traits = make_traits<value_type_of<Expression>, tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Expression>;
|
using _recursive_traits = make_recursive_traits<Expression>;
|
||||||
|
|
||||||
static_assert(is_expression_t<Expression>::value, "invalid argument for an expression alias");
|
static_assert(is_expression_t<Expression>::value, "invalid argument for an expression alias");
|
||||||
static_assert(not is_alias_t<Expression>::value, "cannot create an alias of an alias");
|
static_assert(not is_alias_t<Expression>::value, "cannot create an alias of an alias");
|
||||||
|
@ -37,8 +37,8 @@ namespace sqlpp
|
|||||||
template<typename Select>
|
template<typename Select>
|
||||||
struct any_t
|
struct any_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Select>, tag::multi_expression>;
|
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::multi_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Select>;
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ namespace sqlpp
|
|||||||
auto any(T t) -> typename vendor::any_t<vendor::wrap_operand_t<T>>
|
auto any(T t) -> typename vendor::any_t<vendor::wrap_operand_t<T>>
|
||||||
{
|
{
|
||||||
static_assert(is_select_t<vendor::wrap_operand_t<T>>::value, "any() requires a select expression as argument");
|
static_assert(is_select_t<vendor::wrap_operand_t<T>>::value, "any() requires a select expression as argument");
|
||||||
static_assert(is_value_t<vendor::wrap_operand_t<T>>::value, "any() requires a single column select expression as argument");
|
static_assert(is_expression_t<vendor::wrap_operand_t<T>>::value, "any() requires a single column select expression as argument");
|
||||||
return { t };
|
return { t };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ namespace sqlpp
|
|||||||
template<typename Flag, typename Expr>
|
template<typename Flag, typename Expr>
|
||||||
struct avg_t: public floating_point::template expression_operators<avg_t<Flag, Expr>>
|
struct avg_t: public floating_point::template expression_operators<avg_t<Flag, Expr>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expr>, tag::expression, tag::named_expression>;
|
using _traits = make_traits<floating_point, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Expr>;
|
||||||
|
|
||||||
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "avg() used with flag other than 'distinct'");
|
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "avg() used with flag other than 'distinct'");
|
||||||
static_assert(is_numeric_t<Expr>::value, "avg() requires a value expression as argument");
|
static_assert(is_numeric_t<Expr>::value, "avg() requires a value expression as argument");
|
||||||
|
@ -42,6 +42,7 @@ namespace sqlpp
|
|||||||
// boolean value type
|
// boolean value type
|
||||||
struct boolean
|
struct boolean
|
||||||
{
|
{
|
||||||
|
using _tag = ::sqlpp::tag::boolean;
|
||||||
using _cpp_value_type = bool;
|
using _cpp_value_type = bool;
|
||||||
|
|
||||||
struct _parameter_t
|
struct _parameter_t
|
||||||
|
@ -45,11 +45,11 @@ namespace sqlpp
|
|||||||
struct column_t: public ColumnSpec::_value_type::template expression_operators<column_t<Table, ColumnSpec>>,
|
struct column_t: public ColumnSpec::_value_type::template expression_operators<column_t<Table, ColumnSpec>>,
|
||||||
public ColumnSpec::_value_type::template column_operators<column_t<Table, ColumnSpec>>
|
public ColumnSpec::_value_type::template column_operators<column_t<Table, ColumnSpec>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<ColumnSpec>, tag::column, tag::expression, tag::named_expression>;
|
using _traits = make_traits<typename ColumnSpec::_value_type, tag::column, tag::expression, tag::named_expression>;
|
||||||
struct _recursive_traits
|
struct _recursive_traits
|
||||||
{
|
{
|
||||||
using _provided_tables = detail::type_set<>;
|
using _provided_tables = detail::type_set<>;
|
||||||
using _required_tables = detail::type_set<_table>;
|
using _required_tables = detail::type_set<Table>;
|
||||||
};
|
};
|
||||||
|
|
||||||
using _spec_t = ColumnSpec;
|
using _spec_t = ColumnSpec;
|
||||||
@ -58,7 +58,7 @@ namespace sqlpp
|
|||||||
using _name_t = typename _spec_t::_name_t;
|
using _name_t = typename _spec_t::_name_t;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using _is_valid_operand = typename value_type_of<ColumnSpec>::template _is_valid_operand<T>;
|
using _is_valid_operand = typename ColumnSpec::_value_type::template _is_valid_operand<T>;
|
||||||
|
|
||||||
column_t() = default;
|
column_t() = default;
|
||||||
column_t(const column_t&) = default;
|
column_t(const column_t&) = default;
|
||||||
|
@ -37,8 +37,8 @@ namespace sqlpp
|
|||||||
template<typename Flag, typename Expr>
|
template<typename Flag, typename Expr>
|
||||||
struct count_t: public sqlpp::detail::integral::template expression_operators<count_t<Flag, Expr>>
|
struct count_t: public sqlpp::detail::integral::template expression_operators<count_t<Flag, Expr>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expr>, tag::expression, tag::named_expression>;
|
using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Expr>;
|
||||||
|
|
||||||
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "count() used with flag other than 'distinct'");
|
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "count() used with flag other than 'distinct'");
|
||||||
static_assert(is_expression_t<Expr>::value, "count() requires a sql expression as argument");
|
static_assert(is_expression_t<Expr>::value, "count() requires a sql expression as argument");
|
||||||
|
@ -33,8 +33,8 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
struct default_value_t
|
struct default_value_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::expression>;
|
using _traits = make_traits<no_value_t, tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
static constexpr bool _is_trivial() { return false; }
|
static constexpr bool _is_trivial() { return false; }
|
||||||
};
|
};
|
||||||
|
@ -36,8 +36,8 @@ namespace sqlpp
|
|||||||
template<typename Select>
|
template<typename Select>
|
||||||
struct exists_t: public boolean::template expression_operators<exists_t<Select>>
|
struct exists_t: public boolean::template expression_operators<exists_t<Select>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<boolean, tag::expression, tag::named_expression>;
|
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Select>;
|
||||||
|
|
||||||
static_assert(is_select_t<Select>::value, "exists() requires a select expression as argument");
|
static_assert(is_select_t<Select>::value, "exists() requires a select expression as argument");
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ namespace sqlpp
|
|||||||
// floating_point value type
|
// floating_point value type
|
||||||
struct floating_point
|
struct floating_point
|
||||||
{
|
{
|
||||||
|
using _tag = ::sqlpp::tag::floating_point;
|
||||||
using _cpp_value_type = double;
|
using _cpp_value_type = double;
|
||||||
|
|
||||||
struct _parameter_t
|
struct _parameter_t
|
||||||
|
@ -50,15 +50,15 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using _provided_tables = detail::type_set<>;
|
using _provided_tables = detail::type_set<>;
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
using _required_tables = ::sqlpp::detail::type_set<>;
|
||||||
static_assert(not is_value_t<T>::value, "value() is to be called with non-sql-type like int, or string");
|
static_assert(not is_expression_t<T>::value, "value() is to be called with non-sql-type like int, or string");
|
||||||
return { t };
|
return { t };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ValueType> // Csaba Csoma suggests: unsafe_sql instead of verbatim
|
template<typename ValueType> // Csaba Csoma suggests: unsafe_sql instead of verbatim
|
||||||
struct verbatim_t: public ValueType::template expression_operators<verbatim_t<ValueType>>
|
struct verbatim_t: public ValueType::template expression_operators<verbatim_t<ValueType>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<ValueType, tag::expression>;
|
using _traits = make_traits<ValueType, ::sqlpp::tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
verbatim_t(std::string verbatim): _verbatim(verbatim) {}
|
verbatim_t(std::string verbatim): _verbatim(verbatim) {}
|
||||||
verbatim_t(const verbatim_t&) = default;
|
verbatim_t(const verbatim_t&) = default;
|
||||||
@ -92,7 +92,7 @@ namespace sqlpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Expression, typename Context>
|
template<typename Expression, typename Context>
|
||||||
auto flatten(const Expression& exp, const Context& context) -> verbatim_t<typename Expression::_value_type::_base_value_type>
|
auto flatten(const Expression& exp, const Context& context) -> verbatim_t<value_type_of<Expression>>
|
||||||
{
|
{
|
||||||
static_assert(not make_parameter_list_t<Expression>::type::size::value, "parameters not supported in flattened expressions");
|
static_assert(not make_parameter_list_t<Expression>::type::size::value, "parameters not supported in flattened expressions");
|
||||||
context.clear();
|
context.clear();
|
||||||
@ -103,8 +103,8 @@ namespace sqlpp
|
|||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct value_list_t // to be used in .in() method
|
struct value_list_t // to be used in .in() method
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<vendor::value_type_t<typename _container_t::value_type>;
|
using _traits = make_traits<vendor::value_type_t<typename Container::value_type>>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _container_t = Container;
|
using _container_t = Container;
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ namespace sqlpp
|
|||||||
template<typename Container>
|
template<typename Container>
|
||||||
auto value_list(Container c) -> value_list_t<Container>
|
auto value_list(Container c) -> value_list_t<Container>
|
||||||
{
|
{
|
||||||
static_assert(not is_value_t<typename Container::value_type>::value, "value_list() is to be called with a container of non-sql-type like std::vector<int>, or std::list(string)");
|
static_assert(not is_expression_t<typename Container::value_type>::value, "value_list() is to be called with a container of non-sql-type like std::vector<int>, or std::list(string)");
|
||||||
return { c };
|
return { c };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ namespace sqlpp
|
|||||||
// integral value type
|
// integral value type
|
||||||
struct integral
|
struct integral
|
||||||
{
|
{
|
||||||
|
using _tag = ::sqlpp::tag::integral;
|
||||||
using _cpp_value_type = int64_t;
|
using _cpp_value_type = int64_t;
|
||||||
|
|
||||||
struct _parameter_t
|
struct _parameter_t
|
||||||
|
@ -77,8 +77,8 @@ namespace sqlpp
|
|||||||
template<typename JoinType, typename Lhs, typename Rhs, typename On = vendor::noop>
|
template<typename JoinType, typename Lhs, typename Rhs, typename On = vendor::noop>
|
||||||
struct join_t
|
struct join_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::table, tag::join>;
|
using _traits = make_traits<no_value_t, tag::table, tag::join>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Lhs, Rhs>;
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
|
|
||||||
static_assert(is_table_t<Lhs>::value, "lhs argument for join() has to be a table or join");
|
static_assert(is_table_t<Lhs>::value, "lhs argument for join() has to be a table or join");
|
||||||
static_assert(is_table_t<Rhs>::value, "rhs argument for join() has to be a table");
|
static_assert(is_table_t<Rhs>::value, "rhs argument for join() has to be a table");
|
||||||
|
@ -34,12 +34,12 @@ namespace sqlpp
|
|||||||
namespace vendor
|
namespace vendor
|
||||||
{
|
{
|
||||||
template<typename Expr>
|
template<typename Expr>
|
||||||
struct max_t: public Expr::_value_type::template expression_operators<max_t<Expr>>
|
struct max_t: public value_type_of<Expr>::template expression_operators<max_t<Expr>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expr>, tag::expression, tag::named_expression>;
|
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Expr>;
|
||||||
|
|
||||||
static_assert(is_value_t<Expr>::value, "max() requires a value expression as argument");
|
static_assert(is_expression_t<Expr>::value, "max() requires a value expression as argument");
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ namespace sqlpp
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
auto max(T t) -> typename vendor::max_t<vendor::wrap_operand_t<T>>
|
auto max(T t) -> typename vendor::max_t<vendor::wrap_operand_t<T>>
|
||||||
{
|
{
|
||||||
static_assert(is_value_t<vendor::wrap_operand_t<T>>::value, "max() requires a value expression as argument");
|
static_assert(is_expression_t<vendor::wrap_operand_t<T>>::value, "max() requires a value expression as argument");
|
||||||
return { t };
|
return { t };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@ namespace sqlpp
|
|||||||
namespace vendor
|
namespace vendor
|
||||||
{
|
{
|
||||||
template<typename Expr>
|
template<typename Expr>
|
||||||
struct min_t: public Expr::_value_type::template expression_operators<min_t<Expr>>
|
struct min_t: public value_type_of<Expr>::template expression_operators<min_t<Expr>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expr>, tag::expression, tag::named_expression>;
|
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Expr>;
|
||||||
|
|
||||||
static_assert(is_value_t<Expr>::value, "min() requires a value expression as argument");
|
static_assert(is_expression_t<Expr>::value, "min() requires a value expression as argument");
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ namespace sqlpp
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
auto min(T t) -> typename vendor::min_t<vendor::wrap_operand_t<T>>
|
auto min(T t) -> typename vendor::min_t<vendor::wrap_operand_t<T>>
|
||||||
{
|
{
|
||||||
static_assert(is_value_t<vendor::wrap_operand_t<T>>::value, "min() requires a value expression as argument");
|
static_assert(is_expression_t<vendor::wrap_operand_t<T>>::value, "min() requires a value expression as argument");
|
||||||
return { t };
|
return { t };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ namespace sqlpp
|
|||||||
template<typename Unused, typename... Columns>
|
template<typename Unused, typename... Columns>
|
||||||
struct multi_column_t
|
struct multi_column_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t>;
|
using _traits = make_traits<no_value_t>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Columns...>;
|
using _recursive_traits = make_recursive_traits<Columns...>;
|
||||||
|
|
||||||
static_assert(detail::all_t<is_named_expression_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
|
static_assert(detail::all_t<is_named_expression_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ namespace sqlpp
|
|||||||
template<typename AliasProvider, typename... Columns>
|
template<typename AliasProvider, typename... Columns>
|
||||||
struct multi_column_alias_t
|
struct multi_column_alias_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, alias>;
|
using _traits = make_traits<no_value_t, tag::alias>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Columns...>;
|
using _recursive_traits = make_recursive_traits<Columns...>;
|
||||||
|
|
||||||
static_assert(detail::all_t<is_named_expression_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
|
static_assert(detail::all_t<is_named_expression_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
struct no_value_t
|
struct no_value_t
|
||||||
{
|
{
|
||||||
|
using _tag = void;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _is_valid_operand
|
struct _is_valid_operand
|
||||||
{
|
{
|
||||||
|
@ -33,8 +33,8 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
struct null_t
|
struct null_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::expression>;
|
using _traits = make_traits<no_value_t, tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace vendor
|
namespace vendor
|
||||||
|
@ -37,8 +37,8 @@ namespace sqlpp
|
|||||||
template<typename Database, typename... Expr>
|
template<typename Database, typename... Expr>
|
||||||
struct on_t
|
struct on_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::on>;
|
using _traits = make_traits<no_value_t, tag::on>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Expr...>;
|
using _recursive_traits = make_recursive_traits<Expr...>;
|
||||||
|
|
||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ namespace sqlpp
|
|||||||
template<typename ValueType, typename NameType>
|
template<typename ValueType, typename NameType>
|
||||||
struct parameter_t: public ValueType::template expression_operators<parameter_t<ValueType, NameType>>
|
struct parameter_t: public ValueType::template expression_operators<parameter_t<ValueType, NameType>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<ValueType, tag::parameter, tag::expression>;
|
using _traits = make_traits<ValueType, tag::parameter, tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _instance_t = typename NameType::_name_t::template _member_t<typename ValueType::_parameter_t>;
|
using _instance_t = typename NameType::_name_t::template _member_t<typename ValueType::_parameter_t>;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ namespace sqlpp
|
|||||||
auto parameter(const ValueType&, const AliasProvider&)
|
auto parameter(const ValueType&, const AliasProvider&)
|
||||||
-> parameter_t<ValueType, AliasProvider>
|
-> parameter_t<ValueType, AliasProvider>
|
||||||
{
|
{
|
||||||
static_assert(is_value_t<ValueType>::value, "first argument is not a value type");
|
static_assert(is_expression_t<ValueType>::value, "first argument is not a value type");
|
||||||
static_assert(is_alias_provider_t<AliasProvider>::value, "second argument is not an alias provider");
|
static_assert(is_alias_provider_t<AliasProvider>::value, "second argument is not an alias provider");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ namespace sqlpp
|
|||||||
// standard select flags
|
// standard select flags
|
||||||
struct all_t
|
struct all_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::select_flag>;
|
using _traits = make_traits<no_value_t, tag::select_flag>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
};
|
};
|
||||||
static constexpr all_t all = {};
|
static constexpr all_t all = {};
|
||||||
|
|
||||||
@ -57,8 +57,8 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct distinct_t
|
struct distinct_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::select_flag>;
|
using _traits = make_traits<no_value_t, tag::select_flag>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
};
|
};
|
||||||
static constexpr distinct_t distinct = {};
|
static constexpr distinct_t distinct = {};
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct straight_join_t
|
struct straight_join_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::select_flag>;
|
using _traits = make_traits<no_value_t, tag::select_flag>;
|
||||||
using _recursive_traits = make_recursive_traits_t<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
};
|
};
|
||||||
static constexpr straight_join_t straight_join = {};
|
static constexpr straight_join_t straight_join = {};
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ namespace sqlpp
|
|||||||
template<typename Select>
|
template<typename Select>
|
||||||
struct some_t
|
struct some_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Select>, tag::multi_expression>;
|
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::multi_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Select>;
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ namespace sqlpp
|
|||||||
auto some(T t) -> typename vendor::some_t<vendor::wrap_operand_t<T>>
|
auto some(T t) -> typename vendor::some_t<vendor::wrap_operand_t<T>>
|
||||||
{
|
{
|
||||||
static_assert(is_select_t<vendor::wrap_operand_t<T>>::value, "some() requires a single column select expression as argument");
|
static_assert(is_select_t<vendor::wrap_operand_t<T>>::value, "some() requires a single column select expression as argument");
|
||||||
static_assert(is_value_t<vendor::wrap_operand_t<T>>::value, "some() requires a single column select expression as argument");
|
static_assert(is_expression_t<vendor::wrap_operand_t<T>>::value, "some() requires a single column select expression as argument");
|
||||||
return { t };
|
return { t };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ namespace sqlpp
|
|||||||
namespace vendor
|
namespace vendor
|
||||||
{
|
{
|
||||||
template<typename Flag, typename Expr>
|
template<typename Flag, typename Expr>
|
||||||
struct sum_t: public Expr::_value_type::template expression_operators<sum_t<Flag, Expr>>
|
struct sum_t: public value_type_of<Expr>::template expression_operators<sum_t<Flag, Expr>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Expr>, tag::expression, tag::named_expression>;
|
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Select>;
|
using _recursive_traits = make_recursive_traits<Expr>;
|
||||||
|
|
||||||
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "sum() used with flag other than 'distinct'");
|
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "sum() used with flag other than 'distinct'");
|
||||||
static_assert(is_numeric_t<Expr>::value, "sum() requires a numeric expression as argument");
|
static_assert(is_numeric_t<Expr>::value, "sum() requires a numeric expression as argument");
|
||||||
|
@ -42,7 +42,7 @@ namespace sqlpp
|
|||||||
template<typename Table, typename... ColumnSpec>
|
template<typename Table, typename... ColumnSpec>
|
||||||
struct table_t: public table_base_t, public ColumnSpec::_name_t::template _member_t<column_t<Table, ColumnSpec>>...
|
struct table_t: public table_base_t, public ColumnSpec::_name_t::template _member_t<column_t<Table, ColumnSpec>>...
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<no_value_t, tag::table>;
|
using _traits = make_traits<no_value_t, tag::table>;
|
||||||
|
|
||||||
struct _recursive_traits
|
struct _recursive_traits
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace sqlpp
|
|||||||
struct table_alias_t: public table_alias_base_t, public ColumnSpec::_name_t::template _member_t<column_t<AliasProvider, ColumnSpec>>...
|
struct table_alias_t: public table_alias_base_t, public ColumnSpec::_name_t::template _member_t<column_t<AliasProvider, ColumnSpec>>...
|
||||||
{
|
{
|
||||||
//FIXME: Need to add join functionality
|
//FIXME: Need to add join functionality
|
||||||
using _traits = make_traits_t<value_type_of<Table>, tag::table, tag::alias, tag::named_expression_if<tag::is_expression<Table>>;
|
using _traits = make_traits<value_type_of<Table>, tag::table, tag::alias, tag::named_expression_if<is_expression_t<Table>>>;
|
||||||
|
|
||||||
struct _recursive_traits
|
struct _recursive_traits
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ namespace sqlpp
|
|||||||
using _provided_tables = detail::type_set<Table>;
|
using _provided_tables = detail::type_set<Table>;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(Table::_required_tables::size::value == 0, "table aliases must not depend on external tables");
|
static_assert(required_tables_of<Table>::size::value == 0, "table aliases must not depend on external tables");
|
||||||
|
|
||||||
using _name_t = typename AliasProvider::_name_t;
|
using _name_t = typename AliasProvider::_name_t;
|
||||||
using _column_tuple_t = std::tuple<column_t<Table, ColumnSpec>...>;
|
using _column_tuple_t = std::tuple<column_t<Table, ColumnSpec>...>;
|
||||||
|
@ -41,6 +41,7 @@ namespace sqlpp
|
|||||||
// text value type
|
// text value type
|
||||||
struct text
|
struct text
|
||||||
{
|
{
|
||||||
|
using _tag = ::sqlpp::tag::text;
|
||||||
using _cpp_value_type = std::string;
|
using _cpp_value_type = std::string;
|
||||||
|
|
||||||
struct _parameter_t
|
struct _parameter_t
|
||||||
|
@ -32,14 +32,15 @@
|
|||||||
#include <sqlpp11/type_traits.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
#include <sqlpp11/serialize.h>
|
#include <sqlpp11/serialize.h>
|
||||||
#include <sqlpp11/vendor/serializer.h>
|
#include <sqlpp11/vendor/serializer.h>
|
||||||
|
#include <sqlpp11/vendor/wrap_operand.h>
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
template<typename Operand>
|
template<typename Operand>
|
||||||
struct tvin_t
|
struct tvin_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits_t<value_type_of<Operand>, tag::operand, tag::expression>;
|
using _traits = make_traits<value_type_of<Operand>, tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits_t<Operand>;
|
using _recursive_traits = make_recursive_traits<Operand>;
|
||||||
|
|
||||||
tvin_t(Operand operand):
|
tvin_t(Operand operand):
|
||||||
_value(operand)
|
_value(operand)
|
||||||
@ -55,7 +56,7 @@ namespace sqlpp
|
|||||||
return _value._is_trivial();
|
return _value._is_trivial();
|
||||||
}
|
}
|
||||||
|
|
||||||
_operand_t _value;
|
Operand _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace vendor
|
namespace vendor
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define SQLPP_TYPE_TRAITS_H
|
#define SQLPP_TYPE_TRAITS_H
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <sqlpp11/vendor/wrap_operand.h>
|
#include <sqlpp11/detail/type_set.h>
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
@ -40,8 +40,12 @@ namespace sqlpp
|
|||||||
template<typename T>\
|
template<typename T>\
|
||||||
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 {};\
|
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 {};\
|
||||||
}\
|
}\
|
||||||
|
namespace tag\
|
||||||
|
{\
|
||||||
|
struct name{};\
|
||||||
|
};\
|
||||||
template<typename T>\
|
template<typename T>\
|
||||||
struct is_##name##_t: detail::is_##name##_impl<T> {};
|
using is_##name##_t = detail::is_element_of<tag::name, typename T::_traits::_tags>;
|
||||||
|
|
||||||
#define SQLPP_IS_COLUMN_TRAIT_GENERATOR(name) \
|
#define SQLPP_IS_COLUMN_TRAIT_GENERATOR(name) \
|
||||||
namespace detail\
|
namespace detail\
|
||||||
@ -77,13 +81,20 @@ namespace sqlpp
|
|||||||
struct connector_##name##_t: detail::connector_##name##_impl<T> {};
|
struct connector_##name##_t: detail::connector_##name##_impl<T> {};
|
||||||
|
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(boolean);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(boolean);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(numeric);
|
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(integral);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(integral);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(floating_point);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(floating_point);
|
||||||
|
template<typename T>
|
||||||
|
using is_numeric_t = detail::any_t<
|
||||||
|
detail::is_element_of<tag::integral, typename T::_traits::_tags>::value,
|
||||||
|
detail::is_element_of<tag::floating_point, typename T::_traits::_tags>::value>;
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(text);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(text);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(value);
|
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(expression);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(expression);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(named_expression);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(named_expression);
|
||||||
|
namespace tag
|
||||||
|
{
|
||||||
|
template<typename C>
|
||||||
|
using named_expression_if = typename std::conditional<C::value, tag::named_expression, void>::type;
|
||||||
|
}
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(multi_expression);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(multi_expression);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(alias);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(alias);
|
||||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_flag);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_flag);
|
||||||
@ -94,41 +105,82 @@ namespace sqlpp
|
|||||||
SQLPP_IS_COLUMN_TRAIT_GENERATOR(can_be_null);
|
SQLPP_IS_COLUMN_TRAIT_GENERATOR(can_be_null);
|
||||||
SQLPP_IS_COLUMN_TRAIT_GENERATOR(trivial_value_is_null);
|
SQLPP_IS_COLUMN_TRAIT_GENERATOR(trivial_value_is_null);
|
||||||
|
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_noop);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(noop);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_table);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(table);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_join);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(join);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_pseudo_table);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(pseudo_table);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_column);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(column);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_select);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(select);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_select_flag_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_flag_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_select_column_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_column_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_from);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(from);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_on);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(on);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_dynamic);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(dynamic);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_where);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(where);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_group_by);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(group_by);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_having);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(having);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_order_by);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(order_by);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_limit);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(limit);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_offset);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(offset);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_using);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(using_);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_column_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(column_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_multi_column);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(multi_column);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_value_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(value_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_assignment);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(assignment);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_update_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(update_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_insert_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_insert_value);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_value);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_insert_value_list);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_value_list);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_sort_order);
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(sort_order);
|
||||||
|
SQLPP_IS_VALUE_TRAIT_GENERATOR(parameter);
|
||||||
|
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(requires_braces);
|
SQLPP_TYPE_TRAIT_GENERATOR(requires_braces);
|
||||||
SQLPP_TYPE_TRAIT_GENERATOR(is_parameter);
|
|
||||||
|
|
||||||
SQLPP_CONNECTOR_TRAIT_GENERATOR(null_result_is_trivial_value);
|
SQLPP_CONNECTOR_TRAIT_GENERATOR(null_result_is_trivial_value);
|
||||||
SQLPP_CONNECTOR_TRAIT_GENERATOR(assert_result_validity);
|
SQLPP_CONNECTOR_TRAIT_GENERATOR(assert_result_validity);
|
||||||
|
|
||||||
template<typename T, template<typename> class IsTag>
|
template<typename T, template<typename> class IsTag>
|
||||||
using copy_type_trait = typename std::conditional<IsTag<T>::value, std::true_type, std::false_type>::type;
|
using copy_type_trait = typename std::conditional<IsTag<T>::value, std::true_type, std::false_type>::type;
|
||||||
|
|
||||||
|
template<typename ValueType, typename... Tags>
|
||||||
|
struct make_traits
|
||||||
|
{
|
||||||
|
using _value_type = ValueType;
|
||||||
|
using _tags = detail::make_type_set_t<typename ValueType::_tag, Tags...>;
|
||||||
|
};
|
||||||
|
template<typename... Arguments>
|
||||||
|
struct make_recursive_traits
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_type_of_impl
|
||||||
|
{
|
||||||
|
using type = typename T::_traits::_value_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct required_table_of_impl
|
||||||
|
{
|
||||||
|
using type = typename T::_recursive_traits::_required_tables;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct provided_table_of_impl
|
||||||
|
{
|
||||||
|
using type = typename T::_recursive_traits::_provided_tables;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
using value_type_of = typename detail::value_type_of_impl<T>::type;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using required_tables_of = typename detail::required_table_of_impl<T>::type;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using provided_tables_of = typename detail::provided_table_of_impl<T>::type;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
25
include/sqlpp11/vendor/assignment.h
vendored
25
include/sqlpp11/vendor/assignment.h
vendored
@ -59,26 +59,21 @@ namespace sqlpp
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
bool is_trivial(const T& t)
|
bool is_trivial(const T& t)
|
||||||
{
|
{
|
||||||
return is_trivial_t<typename T::value_type>::_(t);
|
return is_trivial_t<value_type_of<T>>::_(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct assignment_t
|
struct assignment_t
|
||||||
{
|
{
|
||||||
struct _traits
|
using _traits = make_traits<no_value_t, tag::assignment>;
|
||||||
{
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
using _is_assignment = std::true_type;
|
|
||||||
using value_type = no_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
using _recursive_traits = make_recursive_traits_t<Lhs, Rhs>;
|
|
||||||
|
|
||||||
using _column_t = Lhs;
|
using _column_t = Lhs;
|
||||||
using _value_t = Lhs;
|
using _value_t = Lhs;
|
||||||
|
|
||||||
static_assert(can_be_null_t<_column_t>::value ? true : not std::is_same<_value_t, null_t>::value, "column must not be null");
|
static_assert(can_be_null_t<_column_t>::value ? true : not std::is_same<_value_t, null_t>::value, "column must not be null");
|
||||||
|
|
||||||
assignment_t(_column_t lhs, value_type rhs):
|
assignment_t(_column_t lhs, _value_t rhs):
|
||||||
_lhs(lhs),
|
_lhs(lhs),
|
||||||
_rhs(rhs)
|
_rhs(rhs)
|
||||||
{}
|
{}
|
||||||
@ -101,7 +96,7 @@ namespace sqlpp
|
|||||||
static Context& _(const T& t, Context& context)
|
static Context& _(const T& t, Context& context)
|
||||||
{
|
{
|
||||||
if ((trivial_value_is_null_t<typename T::_column_t>::value
|
if ((trivial_value_is_null_t<typename T::_column_t>::value
|
||||||
and is_trivial_t<typename T::value_type>::_(t._rhs))
|
and is_trivial_t<value_type_of<T>>::_(t._rhs))
|
||||||
or (std::is_same<Rhs, null_t>::value))
|
or (std::is_same<Rhs, null_t>::value))
|
||||||
{
|
{
|
||||||
serialize(simple_column(t._lhs), context);
|
serialize(simple_column(t._lhs), context);
|
||||||
@ -120,15 +115,9 @@ namespace sqlpp
|
|||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct assignment_t<Lhs, tvin_t<Rhs>>
|
struct assignment_t<Lhs, tvin_t<Rhs>>
|
||||||
{
|
{
|
||||||
struct _traits
|
using _traits = make_traits<no_value_t, tag::assignment>;
|
||||||
{
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
using _is_assignment = std::true_type;
|
|
||||||
using value_type = no_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
using _recursive_traits = make_recursive_traits_t<Lhs, Rhs>;
|
|
||||||
|
|
||||||
using _is_assignment = std::true_type;
|
|
||||||
using _column_t = Lhs;
|
using _column_t = Lhs;
|
||||||
using _value_t = tvin_t<Rhs>;
|
using _value_t = tvin_t<Rhs>;
|
||||||
|
|
||||||
|
14
include/sqlpp11/vendor/concat.h
vendored
14
include/sqlpp11/vendor/concat.h
vendored
@ -35,19 +35,15 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
namespace vendor
|
namespace vendor
|
||||||
{
|
{
|
||||||
|
// FIXME: Remove First, inherit from text_t
|
||||||
template<typename First, typename... Args>
|
template<typename First, typename... Args>
|
||||||
struct concat_t: public First::_value_type::template expression_operators<concat_t<First, Args...>>
|
struct concat_t: public value_type_of<First>::template expression_operators<concat_t<First, Args...>>
|
||||||
{
|
{
|
||||||
|
using _traits = make_traits<value_type_of<First>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
|
using _recursive_traits = make_recursive_traits<First, Args...>;
|
||||||
|
|
||||||
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");
|
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");
|
||||||
static_assert(sqlpp::detail::all_t<is_text_t<First>::value, is_text_t<Args>::value...>::value, "at least one non-text argument detected in concat()");
|
static_assert(sqlpp::detail::all_t<is_text_t<First>::value, is_text_t<Args>::value...>::value, "at least one non-text argument detected in concat()");
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename First::_required_tables, typename Args::_required_tables...>::type;
|
|
||||||
|
|
||||||
struct _value_type: public First::_value_type::_base_value_type
|
|
||||||
{
|
|
||||||
using _is_named_expression = std::true_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
static constexpr const char* _get_name() { return "CONCAT"; }
|
static constexpr const char* _get_name() { return "CONCAT"; }
|
||||||
|
40
include/sqlpp11/vendor/expression.h
vendored
40
include/sqlpp11/vendor/expression.h
vendored
@ -42,10 +42,8 @@ namespace sqlpp
|
|||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct binary_expression_t<Lhs, tag::equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<equal_to_t<Lhs, Rhs>>
|
struct binary_expression_t<Lhs, tag::equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<equal_to_t<Lhs, Rhs>>
|
||||||
{
|
{
|
||||||
using _value_type = ::sqlpp::detail::boolean;
|
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||||
using _parameter_tuple_t = std::tuple<Lhs, Rhs>;
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Lhs::_required_tables, typename Rhs::_required_tables>::type;
|
|
||||||
|
|
||||||
binary_expression_t(Lhs lhs, Rhs rhs):
|
binary_expression_t(Lhs lhs, Rhs rhs):
|
||||||
_lhs(lhs),
|
_lhs(lhs),
|
||||||
@ -88,10 +86,8 @@ namespace sqlpp
|
|||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct binary_expression_t<Lhs, tag::not_equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<not_equal_to_t<Lhs, Rhs>>
|
struct binary_expression_t<Lhs, tag::not_equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<not_equal_to_t<Lhs, Rhs>>
|
||||||
{
|
{
|
||||||
using _value_type = ::sqlpp::detail::boolean;
|
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||||
using _parameter_tuple_t = std::tuple<Lhs, Rhs>;
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Lhs::_required_tables, typename Rhs::_required_tables>::type;
|
|
||||||
|
|
||||||
binary_expression_t(Lhs lhs, Rhs rhs):
|
binary_expression_t(Lhs lhs, Rhs rhs):
|
||||||
_lhs(lhs),
|
_lhs(lhs),
|
||||||
@ -134,10 +130,8 @@ namespace sqlpp
|
|||||||
template<typename Rhs>
|
template<typename Rhs>
|
||||||
struct unary_expression_t<tag::logical_not, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<logical_not_t<Rhs>>
|
struct unary_expression_t<tag::logical_not, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<logical_not_t<Rhs>>
|
||||||
{
|
{
|
||||||
using _value_type = ::sqlpp::detail::boolean;
|
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||||
using _parameter_tuple_t = std::tuple<Rhs>;
|
using _recursive_traits = make_recursive_traits<Rhs>;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename Rhs::_required_tables;
|
|
||||||
|
|
||||||
unary_expression_t(Rhs rhs):
|
unary_expression_t(Rhs rhs):
|
||||||
_rhs(rhs)
|
_rhs(rhs)
|
||||||
@ -168,16 +162,12 @@ namespace sqlpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename O, typename Rhs>
|
template<typename Lhs, typename O, typename Rhs>
|
||||||
struct binary_expression_t: public O::_value_type::template expression_operators<binary_expression_t<Lhs, O, Rhs>>
|
struct binary_expression_t: public value_type_of<O>::template expression_operators<binary_expression_t<Lhs, O, Rhs>>
|
||||||
{
|
{
|
||||||
using _lhs_t = Lhs;
|
using _traits = make_traits<value_type_of<O>, sqlpp::tag::expression>;
|
||||||
using _rhs_t = Rhs;
|
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||||
using _value_type = typename O::_value_type;
|
|
||||||
using _parameter_tuple_t = std::tuple<_lhs_t, _rhs_t>;
|
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Lhs::_required_tables, typename Rhs::_required_tables>::type;
|
|
||||||
|
|
||||||
binary_expression_t(_lhs_t lhs, _rhs_t rhs):
|
binary_expression_t(Lhs lhs, Rhs rhs):
|
||||||
_lhs(lhs),
|
_lhs(lhs),
|
||||||
_rhs(rhs)
|
_rhs(rhs)
|
||||||
{}
|
{}
|
||||||
@ -188,8 +178,8 @@ namespace sqlpp
|
|||||||
binary_expression_t& operator=(binary_expression_t&&) = default;
|
binary_expression_t& operator=(binary_expression_t&&) = default;
|
||||||
~binary_expression_t() = default;
|
~binary_expression_t() = default;
|
||||||
|
|
||||||
_lhs_t _lhs;
|
Lhs _lhs;
|
||||||
_rhs_t _rhs;
|
Rhs _rhs;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Context, typename Lhs, typename O, typename Rhs>
|
template<typename Context, typename Lhs, typename O, typename Rhs>
|
||||||
@ -211,10 +201,8 @@ namespace sqlpp
|
|||||||
template<typename O, typename Rhs>
|
template<typename O, typename Rhs>
|
||||||
struct unary_expression_t: public O::_value_type::template expression_operators<unary_expression_t<O, Rhs>>
|
struct unary_expression_t: public O::_value_type::template expression_operators<unary_expression_t<O, Rhs>>
|
||||||
{
|
{
|
||||||
using _value_type = typename O::_value_type;
|
using _traits = make_traits<value_type_of<O>, sqlpp::tag::expression>;
|
||||||
using _parameter_tuple_t = std::tuple<Rhs>;
|
using _recursive_traits = make_recursive_traits<Rhs>;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename Rhs::_required_tables;
|
|
||||||
|
|
||||||
unary_expression_t(Rhs rhs):
|
unary_expression_t(Rhs rhs):
|
||||||
_rhs(rhs)
|
_rhs(rhs)
|
||||||
|
16
include/sqlpp11/vendor/extra_tables.h
vendored
16
include/sqlpp11/vendor/extra_tables.h
vendored
@ -39,18 +39,15 @@ namespace sqlpp
|
|||||||
template<typename... Tables>
|
template<typename... Tables>
|
||||||
struct extra_tables_t
|
struct extra_tables_t
|
||||||
{
|
{
|
||||||
using _is_extra_tables = std::true_type;
|
using _traits = make_traits<no_value_t, tag::extra_tables>;
|
||||||
|
using _recursive_traits = make_recursive_traits<Tables...>;
|
||||||
|
|
||||||
|
// FIXME: extra_tables must not require tables!
|
||||||
|
|
||||||
static_assert(sizeof...(Tables), "at least one table or join argument required in extra_tables()");
|
static_assert(sizeof...(Tables), "at least one table or join argument required in extra_tables()");
|
||||||
|
|
||||||
static_assert(not ::sqlpp::detail::has_duplicates<Tables...>::value, "at least one duplicate argument detected in extra_tables()");
|
static_assert(not ::sqlpp::detail::has_duplicates<Tables...>::value, "at least one duplicate argument detected in extra_tables()");
|
||||||
|
|
||||||
static_assert(::sqlpp::detail::all_t<is_table_t<Tables>::value...>::value, "at least one argument is not a table or join in extra_tables()");
|
static_assert(::sqlpp::detail::all_t<is_table_t<Tables>::value...>::value, "at least one argument is not a table or join in extra_tables()");
|
||||||
|
|
||||||
using _provided_tables = ::sqlpp::detail::make_joined_set_t<typename Tables::_provided_tables...>;
|
|
||||||
using _required_tables = ::sqlpp::detail::make_joined_set_t<typename Tables::_required_tables...>;
|
|
||||||
|
|
||||||
|
|
||||||
extra_tables_t()
|
extra_tables_t()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -68,9 +65,8 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct no_extra_tables_t
|
struct no_extra_tables_t
|
||||||
{
|
{
|
||||||
using _is_noop = std::true_type;
|
using _traits = make_traits<no_value_t, tag::noop>;
|
||||||
using _provided_tables = detail::type_set<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
template<typename Policies>
|
template<typename Policies>
|
||||||
struct _methods_t
|
struct _methods_t
|
||||||
|
2
include/sqlpp11/vendor/field.h
vendored
2
include/sqlpp11/vendor/field.h
vendored
@ -52,7 +52,7 @@ namespace sqlpp
|
|||||||
struct make_field_t_impl
|
struct make_field_t_impl
|
||||||
{
|
{
|
||||||
using type = field_t<typename NamedExpr::_name_t,
|
using type = field_t<typename NamedExpr::_name_t,
|
||||||
typename NamedExpr::_value_type::_base_value_type,
|
value_of<NamedExpr>,
|
||||||
trivial_value_is_null_t<NamedExpr>::value>;
|
trivial_value_is_null_t<NamedExpr>::value>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
13
include/sqlpp11/vendor/from.h
vendored
13
include/sqlpp11/vendor/from.h
vendored
@ -41,9 +41,9 @@ namespace sqlpp
|
|||||||
template<typename Database, typename... Tables>
|
template<typename Database, typename... Tables>
|
||||||
struct from_t
|
struct from_t
|
||||||
{
|
{
|
||||||
using _is_from = std::true_type;
|
using _traits = make_traits<no_value_t, tag::from>;
|
||||||
using _required_tables = ::sqlpp::detail::make_joined_set_t<typename Tables::_required_tables...>;
|
using _recursive_traits = make_recursive_traits<Tables...>;
|
||||||
using _provided_tables = ::sqlpp::detail::make_joined_set_t<typename Tables::_provided_tables...>;
|
|
||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
|
|
||||||
static_assert(_is_dynamic::value or sizeof...(Tables), "at least one table or join argument required in from()");
|
static_assert(_is_dynamic::value or sizeof...(Tables), "at least one table or join argument required in from()");
|
||||||
@ -53,7 +53,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
static_assert(::sqlpp::detail::all_t<is_table_t<Tables>::value...>::value, "at least one argument is not a table or join in from()");
|
static_assert(::sqlpp::detail::all_t<is_table_t<Tables>::value...>::value, "at least one argument is not a table or join in from()");
|
||||||
|
|
||||||
static_assert(_required_tables::size::value == 0, "at least one table depends on another table");
|
static_assert(required_tables_of<from_t>::size::value == 0, "at least one table depends on another table");
|
||||||
|
|
||||||
|
|
||||||
from_t(Tables... tables):
|
from_t(Tables... tables):
|
||||||
@ -97,9 +97,8 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct no_from_t
|
struct no_from_t
|
||||||
{
|
{
|
||||||
using _is_noop = std::true_type;
|
using _traits = make_traits<no_value_t, tag::noop>;
|
||||||
using _provided_tables = detail::type_set<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
template<typename Policies>
|
template<typename Policies>
|
||||||
struct _methods_t
|
struct _methods_t
|
||||||
|
16
include/sqlpp11/vendor/group_by.h
vendored
16
include/sqlpp11/vendor/group_by.h
vendored
@ -43,13 +43,10 @@ namespace sqlpp
|
|||||||
template<typename Database, typename... Expressions>
|
template<typename Database, typename... Expressions>
|
||||||
struct group_by_t
|
struct group_by_t
|
||||||
{
|
{
|
||||||
using _is_group_by = std::true_type;
|
using _traits = make_traits<no_value_t, tag::group_by>;
|
||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _recursive_traits = make_recursive_traits<Expressions...>;
|
||||||
using _parameter_tuple_t = std::tuple<Expressions...>;
|
|
||||||
using _parameter_list_t = typename make_parameter_list_t<_parameter_tuple_t>::type;
|
|
||||||
|
|
||||||
using _provided_tables = detail::type_set<>;
|
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Expressions::_required_tables...>::type;
|
|
||||||
|
|
||||||
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression (e.g. a column) required in group_by()");
|
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression (e.g. a column) required in group_by()");
|
||||||
|
|
||||||
@ -100,15 +97,14 @@ namespace sqlpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
const group_by_t& _group_by() const { return *this; }
|
const group_by_t& _group_by() const { return *this; }
|
||||||
_parameter_tuple_t _expressions;
|
std::tuple<Expression...> _expressions;
|
||||||
vendor::interpretable_list_t<Database> _dynamic_expressions;
|
vendor::interpretable_list_t<Database> _dynamic_expressions;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct no_group_by_t
|
struct no_group_by_t
|
||||||
{
|
{
|
||||||
using _is_noop = std::true_type;
|
using _traits = make_traits<no_value_t, tag::noop>;
|
||||||
using _provided_tables = detail::type_set<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
template<typename Policies>
|
template<typename Policies>
|
||||||
struct _methods_t
|
struct _methods_t
|
||||||
|
17
include/sqlpp11/vendor/having.h
vendored
17
include/sqlpp11/vendor/having.h
vendored
@ -42,18 +42,14 @@ namespace sqlpp
|
|||||||
template<typename Database, typename... Expressions>
|
template<typename Database, typename... Expressions>
|
||||||
struct having_t
|
struct having_t
|
||||||
{
|
{
|
||||||
using _is_having = std::true_type;
|
using _traits = make_traits<no_value_t, tag::having>;
|
||||||
|
using _recursive_traits = make_recursive_traits<Expressions...>;
|
||||||
|
|
||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||||
using _parameter_tuple_t = std::tuple<Expressions...>;
|
|
||||||
|
|
||||||
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression argument required in having()");
|
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression argument required in having()");
|
||||||
static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in having()");
|
static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in having()");
|
||||||
|
|
||||||
using _parameter_list_t = typename make_parameter_list_t<_parameter_tuple_t>::type;
|
|
||||||
|
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Expressions::_required_tables...>::type;
|
|
||||||
|
|
||||||
having_t(Expressions... expressions):
|
having_t(Expressions... expressions):
|
||||||
_expressions(expressions...)
|
_expressions(expressions...)
|
||||||
{}
|
{}
|
||||||
@ -96,15 +92,14 @@ namespace sqlpp
|
|||||||
void _add_having_impl(Expression expression, const std::false_type&);
|
void _add_having_impl(Expression expression, const std::false_type&);
|
||||||
};
|
};
|
||||||
|
|
||||||
_parameter_tuple_t _expressions;
|
std::tuple<Expressions...> _expressions;
|
||||||
vendor::interpretable_list_t<Database> _dynamic_expressions;
|
vendor::interpretable_list_t<Database> _dynamic_expressions;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct no_having_t
|
struct no_having_t
|
||||||
{
|
{
|
||||||
using _is_noop = std::true_type;
|
using _traits = make_traits<no_value_t, tag::noop>;
|
||||||
using _provided_tables = detail::type_set<>;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
template<typename Policies>
|
template<typename Policies>
|
||||||
struct _methods_t
|
struct _methods_t
|
||||||
|
10
include/sqlpp11/vendor/in.h
vendored
10
include/sqlpp11/vendor/in.h
vendored
@ -39,14 +39,12 @@ namespace sqlpp
|
|||||||
template<bool NotInverted, typename Operand, typename... Args>
|
template<bool NotInverted, typename Operand, typename... Args>
|
||||||
struct in_t: public boolean::template expression_operators<in_t<NotInverted, Operand, Args...>>
|
struct in_t: public boolean::template expression_operators<in_t<NotInverted, Operand, Args...>>
|
||||||
{
|
{
|
||||||
|
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
|
using _recursive_traits = make_recursive_traits<Operand, Args...>;
|
||||||
|
|
||||||
static constexpr bool _inverted = not NotInverted;
|
static constexpr bool _inverted = not NotInverted;
|
||||||
static_assert(sizeof...(Args) > 0, "in() requires at least one argument");
|
static_assert(sizeof...(Args) > 0, "in() requires at least one argument");
|
||||||
|
|
||||||
struct _value_type: public boolean
|
|
||||||
{
|
|
||||||
using _is_named_expression = std::true_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
static constexpr const char* _get_name() { return _inverted ? "NOT IN" : "IN"; }
|
static constexpr const char* _get_name() { return _inverted ? "NOT IN" : "IN"; }
|
||||||
@ -56,8 +54,6 @@ namespace sqlpp
|
|||||||
T in;
|
T in;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Operand::_required_tables, typename Args::_required_tables...>::type;
|
|
||||||
|
|
||||||
in_t(Operand operand, Args... args):
|
in_t(Operand operand, Args... args):
|
||||||
_operand(operand),
|
_operand(operand),
|
||||||
|
5
include/sqlpp11/vendor/is_null.h
vendored
5
include/sqlpp11/vendor/is_null.h
vendored
@ -38,9 +38,10 @@ namespace sqlpp
|
|||||||
template<bool NotInverted, typename Operand>
|
template<bool NotInverted, typename Operand>
|
||||||
struct is_null_t: public boolean::template expression_operators<is_null_t<NotInverted, Operand>>
|
struct is_null_t: public boolean::template expression_operators<is_null_t<NotInverted, Operand>>
|
||||||
{
|
{
|
||||||
|
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
|
using _recursive_traits = make_recursive_traits<Operand>;
|
||||||
|
|
||||||
static constexpr bool _inverted = not NotInverted;
|
static constexpr bool _inverted = not NotInverted;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename Operand::_required_tables;
|
|
||||||
|
|
||||||
struct _value_type: public boolean
|
struct _value_type: public boolean
|
||||||
{
|
{
|
||||||
|
11
include/sqlpp11/vendor/like.h
vendored
11
include/sqlpp11/vendor/like.h
vendored
@ -38,16 +38,11 @@ namespace sqlpp
|
|||||||
template<typename Operand, typename Pattern>
|
template<typename Operand, typename Pattern>
|
||||||
struct like_t: public boolean::template expression_operators<like_t<Operand, Pattern>>
|
struct like_t: public boolean::template expression_operators<like_t<Operand, Pattern>>
|
||||||
{
|
{
|
||||||
|
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||||
|
using _recursive_traits = make_recursive_traits<Operand, Pattern>;
|
||||||
|
|
||||||
static_assert(is_text_t<Operand>::value, "Operand for like() has to be a text");
|
static_assert(is_text_t<Operand>::value, "Operand for like() has to be a text");
|
||||||
static_assert(is_text_t<Pattern>::value, "Pattern for like() has to be a text");
|
static_assert(is_text_t<Pattern>::value, "Pattern for like() has to be a text");
|
||||||
using _parameter_tuple_t = std::tuple<Operand, Pattern>;
|
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = typename ::sqlpp::detail::make_joined_set<typename Operand::_required_tables, typename Pattern::_required_tables>::type;
|
|
||||||
|
|
||||||
struct _value_type: public boolean
|
|
||||||
{
|
|
||||||
using _is_named_expression = std::true_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _name_t
|
struct _name_t
|
||||||
{
|
{
|
||||||
|
2
include/sqlpp11/vendor/value_type.h
vendored
2
include/sqlpp11/vendor/value_type.h
vendored
@ -35,7 +35,7 @@ namespace sqlpp
|
|||||||
namespace vendor
|
namespace vendor
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using value_type_t = typename wrap_operand<T>::type::_value_type;
|
using value_type_t = value_type_of<wrap_operand_t<T>>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
30
include/sqlpp11/vendor/wrap_operand.h
vendored
30
include/sqlpp11/vendor/wrap_operand.h
vendored
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sqlpp11/vendor/serializer.h>
|
#include <sqlpp11/vendor/serializer.h>
|
||||||
#include <sqlpp11/detail/type_set.h>
|
#include <sqlpp11/type_traits.h>
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
@ -45,11 +45,10 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
struct boolean_operand
|
struct boolean_operand
|
||||||
{
|
{
|
||||||
static constexpr bool _is_expression = true;
|
using _traits = make_traits<::sqlpp::detail::boolean, ::sqlpp::tag::expression>;
|
||||||
using _value_type = sqlpp::detail::boolean;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _value_t = bool;
|
using _value_t = bool;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
boolean_operand():
|
boolean_operand():
|
||||||
_t{}
|
_t{}
|
||||||
@ -84,11 +83,10 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct integral_operand
|
struct integral_operand
|
||||||
{
|
{
|
||||||
static constexpr bool _is_expression = true;
|
using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::expression>;
|
||||||
using _value_type = ::sqlpp::detail::integral;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _value_t = int64_t;
|
using _value_t = int64_t;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
integral_operand():
|
integral_operand():
|
||||||
_t{}
|
_t{}
|
||||||
@ -124,11 +122,10 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct floating_point_operand
|
struct floating_point_operand
|
||||||
{
|
{
|
||||||
static constexpr bool _is_expression = true;
|
using _traits = make_traits<::sqlpp::detail::floating_point, ::sqlpp::tag::expression>;
|
||||||
using _value_type = ::sqlpp::detail::floating_point;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _value_t = double;
|
using _value_t = double;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
floating_point_operand():
|
floating_point_operand():
|
||||||
_t{}
|
_t{}
|
||||||
@ -163,11 +160,10 @@ namespace sqlpp
|
|||||||
|
|
||||||
struct text_operand
|
struct text_operand
|
||||||
{
|
{
|
||||||
static constexpr bool _is_expression = true;
|
using _traits = make_traits<::sqlpp::detail::text, ::sqlpp::tag::expression>;
|
||||||
using _value_type = ::sqlpp::detail::text;
|
using _recursive_traits = make_recursive_traits<>;
|
||||||
|
|
||||||
using _value_t = std::string;
|
using _value_t = std::string;
|
||||||
using _provided_tables = detail::type_set<>;
|
|
||||||
using _required_tables = ::sqlpp::detail::type_set<>;
|
|
||||||
|
|
||||||
text_operand():
|
text_operand():
|
||||||
_t{}
|
_t{}
|
||||||
|
@ -6,14 +6,14 @@ macro (build_and_run arg)
|
|||||||
add_test(${arg} ${arg})
|
add_test(${arg} ${arg})
|
||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
||||||
build_and_run(InterpretTest)
|
#build_and_run(InterpretTest)
|
||||||
build_and_run(InsertTest)
|
#build_and_run(InsertTest)
|
||||||
build_and_run(RemoveTest)
|
#build_and_run(RemoveTest)
|
||||||
build_and_run(UpdateTest)
|
#build_and_run(UpdateTest)
|
||||||
build_and_run(SelectTest)
|
#build_and_run(SelectTest)
|
||||||
build_and_run(SelectTypeTest)
|
#build_and_run(SelectTypeTest)
|
||||||
build_and_run(FunctionTest)
|
build_and_run(FunctionTest)
|
||||||
build_and_run(PreparedTest)
|
#build_and_run(PreparedTest)
|
||||||
|
|
||||||
find_package(PythonInterp REQUIRED)
|
find_package(PythonInterp REQUIRED)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "Sample.h"
|
#include "Sample.h"
|
||||||
#include "MockDb.h"
|
#include "MockDb.h"
|
||||||
#include <sqlpp11/alias_provider.h>
|
#include <sqlpp11/alias_provider.h>
|
||||||
#include <sqlpp11/select.h>
|
//#include <sqlpp11/select.h>
|
||||||
#include <sqlpp11/functions.h>
|
#include <sqlpp11/functions.h>
|
||||||
#include <sqlpp11/connection.h>
|
#include <sqlpp11/connection.h>
|
||||||
|
|
||||||
@ -171,6 +171,7 @@ int main()
|
|||||||
// SUB_SELECT_FUNCTIONS
|
// SUB_SELECT_FUNCTIONS
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Test exists
|
// Test exists
|
||||||
{
|
{
|
||||||
using TI = decltype(exists(select(t.alpha).from(t)));
|
using TI = decltype(exists(select(t.alpha).from(t)));
|
||||||
@ -232,6 +233,7 @@ int main()
|
|||||||
static_assert(not sqlpp::is_floating_point_t<TT>::value, "type requirement");
|
static_assert(not sqlpp::is_floating_point_t<TT>::value, "type requirement");
|
||||||
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
|
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// NUMERIC FUNCTIONS
|
// NUMERIC FUNCTIONS
|
||||||
// -----------------
|
// -----------------
|
||||||
|
Loading…
Reference in New Issue
Block a user