mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-04 12:10:43 -06:00
Everything compiles again.
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#ifndef SQLPP_POLICY_UPDATE_H
|
||||
#define SQLPP_POLICY_UPDATE_H
|
||||
|
||||
#include <sqlpp11/bad_statement.h>
|
||||
#include <sqlpp11/wrong.h>
|
||||
|
||||
namespace sqlpp
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#ifndef SQLPP_PRE_JOIN_H
|
||||
#define SQLPP_PRE_JOIN_H
|
||||
|
||||
#include <sqlpp11/bad_statement.h>
|
||||
#include <sqlpp11/join_types.h>
|
||||
#include <sqlpp11/noop.h>
|
||||
#include <sqlpp11/on.h>
|
||||
@@ -144,18 +143,38 @@ namespace sqlpp
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto join(Lhs lhs, Rhs rhs) -> typename std::
|
||||
conditional<check_pre_join_t<Lhs, Rhs>::value, pre_join_t<inner_join_t, Lhs, Rhs>, bad_statement>::type
|
||||
namespace detail
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{}; // FIXME: Failure return type?
|
||||
template <typename JoinType, typename Check, typename Lhs, typename Rhs>
|
||||
auto join_impl(Check, Lhs lhs, Rhs rhs) -> Check;
|
||||
|
||||
template <typename JoinType, typename Lhs, typename Rhs>
|
||||
auto join_impl(consistent_t, Lhs lhs, Rhs rhs) -> pre_join_t<JoinType, Lhs, Rhs>;
|
||||
|
||||
template <typename JoinType, typename Lhs, typename Rhs>
|
||||
auto join_impl(Lhs lhs, Rhs rhs) -> decltype(join_impl<JoinType>(check_pre_join_t<Lhs, Rhs>{}, lhs, rhs));
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl<inner_join_t>(lhs, rhs))
|
||||
{
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto inner_join(Lhs lhs, Rhs rhs) -> typename std::
|
||||
conditional<check_pre_join_t<Lhs, Rhs>::value, pre_join_t<inner_join_t, Lhs, Rhs>, bad_statement>::type
|
||||
auto inner_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl<inner_join_t>(lhs, rhs))
|
||||
{
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto left_outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl<left_outer_join_t>(lhs, rhs))
|
||||
{
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto right_outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl<right_outer_join_t>(lhs, rhs))
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{};
|
||||
|
||||
@@ -163,40 +182,27 @@ namespace sqlpp
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto left_outer_join(Lhs lhs, Rhs rhs) -> typename std::
|
||||
conditional<check_pre_join_t<Lhs, Rhs>::value, pre_join_t<left_outer_join_t, Lhs, Rhs>, bad_statement>::type
|
||||
auto outer_join(Lhs lhs, Rhs rhs) -> decltype(detail::join_impl<outer_join_t>(lhs, rhs))
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{};
|
||||
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto right_outer_join(Lhs lhs, Rhs rhs) -> typename std::
|
||||
conditional<check_pre_join_t<Lhs, Rhs>::value, pre_join_t<right_outer_join_t, Lhs, Rhs>, bad_statement>::type
|
||||
namespace detail
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{};
|
||||
template <typename Check, typename Lhs, typename Rhs>
|
||||
auto cross_join_impl(Check, Lhs lhs, Rhs rhs) -> Check;
|
||||
|
||||
return {lhs, rhs};
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto cross_join_impl(consistent_t, Lhs lhs, Rhs rhs)
|
||||
-> join_t<pre_join_t<cross_join_t, Lhs, Rhs>, on_t<unconditional_t>>;
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto cross_join_impl(Lhs lhs, Rhs rhs) -> decltype(cross_join_impl(check_pre_join_t<Lhs, Rhs>{}, lhs, rhs));
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto outer_join(Lhs lhs, Rhs rhs) -> typename std::
|
||||
conditional<check_pre_join_t<Lhs, Rhs>::value, pre_join_t<outer_join_t, Lhs, Rhs>, bad_statement>::type
|
||||
auto cross_join(Lhs lhs, Rhs rhs) -> decltype(detail::cross_join_impl(lhs, rhs))
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{};
|
||||
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
auto cross_join(Lhs lhs, Rhs rhs) ->
|
||||
typename std::conditional<check_pre_join_t<Lhs, Rhs>::value,
|
||||
join_t<pre_join_t<cross_join_t, Lhs, Rhs>, on_t<unconditional_t>>,
|
||||
bad_statement>::type
|
||||
{
|
||||
check_pre_join_t<Lhs, Rhs>{};
|
||||
|
||||
return {pre_join_t<cross_join_t, Lhs, Rhs>{lhs, rhs}, {}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
#ifndef SQLPP_UNION_H
|
||||
#define SQLPP_UNION_H
|
||||
|
||||
#include <sqlpp11/union_data.h>
|
||||
#include <sqlpp11/union_flags.h>
|
||||
#include <sqlpp11/statement_fwd.h>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/parameter_list.h>
|
||||
#include <sqlpp11/expression.h>
|
||||
#include <sqlpp11/interpret_tuple.h>
|
||||
#include <sqlpp11/interpretable_list.h>
|
||||
#include <sqlpp11/result_row.h>
|
||||
#include <sqlpp11/logic.h>
|
||||
#include <sqlpp11/parameter_list.h>
|
||||
#include <sqlpp11/result_row.h>
|
||||
#include <sqlpp11/statement_fwd.h>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/union_data.h>
|
||||
#include <sqlpp11/union_flags.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
@@ -45,19 +45,19 @@ namespace sqlpp
|
||||
using blank_union_t = statement_t<void, no_union_t>;
|
||||
// There is no order by or limit or offset in union, use it as a pseudo table to do that.
|
||||
|
||||
template <bool, typename Union>
|
||||
template <typename Check, typename Union>
|
||||
struct union_statement_impl
|
||||
{
|
||||
using type = Check;
|
||||
};
|
||||
|
||||
template <typename Union>
|
||||
struct union_statement_impl<consistent_t, Union>
|
||||
{
|
||||
using type = statement_t<void, Union, no_union_t>;
|
||||
};
|
||||
|
||||
template <typename Union>
|
||||
struct union_statement_impl<false, Union>
|
||||
{
|
||||
using type = bad_statement;
|
||||
};
|
||||
|
||||
template <bool Check, typename Union>
|
||||
template <typename Check, typename Union>
|
||||
using union_statement_t = typename union_statement_impl<Check, Union>::type;
|
||||
|
||||
// UNION(EXPR)
|
||||
@@ -95,8 +95,7 @@ namespace sqlpp
|
||||
|
||||
// workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269
|
||||
template <typename... Args>
|
||||
_base_t(Args&&... args)
|
||||
: union_{std::forward<Args>(args)...}
|
||||
_base_t(Args&&... args) : union_{std::forward<Args>(args)...}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -166,8 +165,7 @@ namespace sqlpp
|
||||
|
||||
// workaround for msvc bug https://connect.microsoft.com/VisualStudio/Feedback/Details/2173269
|
||||
template <typename... Args>
|
||||
_base_t(Args&&... args)
|
||||
: no_union{std::forward<Args>(args)...}
|
||||
_base_t(Args&&... args) : no_union{std::forward<Args>(args)...}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -196,7 +194,7 @@ namespace sqlpp
|
||||
using _check = typename logic::all<is_statement_t<T>::value...>::type;
|
||||
|
||||
template <typename Check, typename T>
|
||||
using _new_statement_t = union_statement_t<Check::value, T>;
|
||||
using _new_statement_t = union_statement_t<Check, T>;
|
||||
|
||||
using _consistency_check = consistent_t;
|
||||
|
||||
@@ -237,16 +235,15 @@ namespace sqlpp
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Database, typename Flag, typename Rhs>
|
||||
auto _union_impl(const std::false_type&, Rhs rhs) const -> bad_statement;
|
||||
template <typename Database, typename Check, typename Flag, typename Rhs>
|
||||
auto _union_impl(Check, Rhs rhs) const -> Check;
|
||||
|
||||
template <typename Database, typename Flag, typename Rhs>
|
||||
auto _union_impl(const std::true_type&, Rhs rhs) const
|
||||
-> _new_statement_t<std::true_type, union_t<Database, Flag, derived_statement_t<Policies>, Rhs>>
|
||||
auto _union_impl(consistent_t, Rhs rhs) const
|
||||
-> _new_statement_t<consistent_t, union_t<Database, Flag, derived_statement_t<Policies>, Rhs>>
|
||||
{
|
||||
return {blank_union_t{},
|
||||
union_data_t<Database, Flag, derived_statement_t<Policies>, Rhs>{
|
||||
static_cast<const derived_statement_t<Policies>&>(*this), rhs}};
|
||||
return {blank_union_t{}, union_data_t<Database, Flag, derived_statement_t<Policies>, Rhs>{
|
||||
static_cast<const derived_statement_t<Policies>&>(*this), rhs}};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user