mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-06 05:00:37 -06:00
Merge branch 'release/0.43'
This commit is contained in:
@@ -88,6 +88,11 @@ namespace sqlpp
|
||||
static_assert(required_tables_of<dynamic_pre_join_t>::size::value == 0,
|
||||
"joined tables must not depend on other tables");
|
||||
|
||||
auto unconditionally() const -> dynamic_join_t<dynamic_pre_join_t, on_t<unconditional_t>>
|
||||
{
|
||||
return {*this, {}};
|
||||
}
|
||||
|
||||
template <typename Expr>
|
||||
auto on(Expr expr) const -> typename std::conditional<check_dynamic_join_on_t<dynamic_pre_join_t, Expr>::value,
|
||||
dynamic_join_t<dynamic_pre_join_t, on_t<Expr>>,
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
#include <sqlpp11/alias.h>
|
||||
#include <sqlpp11/data_types/boolean.h>
|
||||
#include <sqlpp11/tvin.h>
|
||||
#include <sqlpp11/rhs_wrap.h>
|
||||
#include <sqlpp11/noop.h>
|
||||
#include <sqlpp11/expression_fwd.h>
|
||||
#include <sqlpp11/noop.h>
|
||||
#include <sqlpp11/rhs_wrap.h>
|
||||
#include <sqlpp11/serializer.h>
|
||||
#include <sqlpp11/tvin.h>
|
||||
#include <sqlpp11/wrap_operand.h>
|
||||
|
||||
namespace sqlpp
|
||||
@@ -126,7 +126,7 @@ namespace sqlpp
|
||||
}
|
||||
else
|
||||
{
|
||||
context << "!=";
|
||||
context << "<>";
|
||||
serialize_operand(t._rhs, context);
|
||||
}
|
||||
context << ")";
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace sqlpp
|
||||
return _having_impl<_database_t>(Check{}, expression);
|
||||
}
|
||||
|
||||
auto dynamic_having() const -> _new_statement_t<check_where_dynamic_t<_database_t, boolean_operand>,
|
||||
auto dynamic_having() const -> _new_statement_t<check_having_dynamic_t<_database_t, boolean_operand>,
|
||||
having_t<_database_t, boolean_operand>>
|
||||
{
|
||||
return dynamic_having(::sqlpp::value(true));
|
||||
|
||||
@@ -153,7 +153,8 @@ namespace sqlpp
|
||||
{
|
||||
// FIXME: Make sure that Limit does not require external tables? Need to read up on SQL
|
||||
using arg_t = wrap_operand_t<Limit>;
|
||||
static_assert(is_integral_t<arg_t>::value, "limit requires an integral value or integral parameter");
|
||||
static_assert(is_unsigned_integral_t<arg_t>::value,
|
||||
"limit requires an unsigned integral value or unsigned integral parameter");
|
||||
_data._value = arg_t{value};
|
||||
_data._initialized = true;
|
||||
}
|
||||
@@ -194,11 +195,13 @@ namespace sqlpp
|
||||
};
|
||||
};
|
||||
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_limit_is_integral, "argument for limit() must be an integral expressions");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_limit_is_unsigned_integral,
|
||||
"argument for limit() must be an unsigned integral expressions");
|
||||
template <typename T>
|
||||
struct check_limit
|
||||
{
|
||||
using type = static_combined_check_t<static_check_t<is_integral_t<T>::value, assert_limit_is_integral>>;
|
||||
using type =
|
||||
static_combined_check_t<static_check_t<is_unsigned_integral_t<T>::value, assert_limit_is_unsigned_integral>>;
|
||||
};
|
||||
template <typename T>
|
||||
using check_limit_t = typename check_limit<wrap_operand_t<T>>::type;
|
||||
|
||||
@@ -57,8 +57,6 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, tag::is_offset>;
|
||||
using _nodes = detail::type_vector<Offset>;
|
||||
|
||||
static_assert(is_integral_t<Offset>::value, "offset requires an integral value or integral parameter");
|
||||
|
||||
// Data
|
||||
using _data_t = offset_data_t<Offset>;
|
||||
|
||||
@@ -155,7 +153,8 @@ namespace sqlpp
|
||||
{
|
||||
// FIXME: Make sure that Offset does not require external tables? Need to read up on SQL
|
||||
using arg_t = wrap_operand_t<Offset>;
|
||||
static_assert(is_integral_t<arg_t>::value, "offset requires an integral value or integral parameter");
|
||||
static_assert(is_unsigned_integral_t<arg_t>::value,
|
||||
"offset requires an unsigned integral value or unsigned integral parameter");
|
||||
_data._value = arg_t{value};
|
||||
_data._initialized = true;
|
||||
}
|
||||
@@ -208,11 +207,13 @@ namespace sqlpp
|
||||
interpretable_t<Database> _value;
|
||||
};
|
||||
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_offset_is_integral, "argument for offset() must be an integral expressions");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_offset_is_unsigned_integral,
|
||||
"argument for offset() must be an integral expressions");
|
||||
template <typename T>
|
||||
struct check_offset
|
||||
{
|
||||
using type = static_combined_check_t<static_check_t<is_integral_t<T>::value, assert_offset_is_integral>>;
|
||||
using type =
|
||||
static_combined_check_t<static_check_t<is_unsigned_integral_t<T>::value, assert_offset_is_unsigned_integral>>;
|
||||
};
|
||||
template <typename T>
|
||||
using check_offset_t = typename check_offset<wrap_operand_t<T>>::type;
|
||||
|
||||
@@ -102,6 +102,11 @@ namespace sqlpp
|
||||
|
||||
static_assert(required_tables_of<pre_join_t>::size::value == 0, "joined tables must not depend on other tables");
|
||||
|
||||
auto unconditionally() -> join_t<pre_join_t, on_t<unconditional_t>>
|
||||
{
|
||||
return {*this, {}};
|
||||
}
|
||||
|
||||
template <typename Expr>
|
||||
auto on(Expr expr) const -> typename std::conditional<check_join_on_t<pre_join_t, Expr>::value,
|
||||
join_t<pre_join_t, on_t<Expr>>,
|
||||
|
||||
@@ -55,7 +55,10 @@ namespace sqlpp
|
||||
struct select_pseudo_table_t
|
||||
: public table_t<select_pseudo_table_t<Select, NamedExpr...>, select_column_spec_t<Select, NamedExpr>...>
|
||||
{
|
||||
using _traits = make_traits<no_value_t, tag::is_table, tag::is_pseudo_table>;
|
||||
using _traits = make_traits<no_value_t,
|
||||
tag::is_table,
|
||||
tag::is_pseudo_table,
|
||||
tag_if<tag::requires_braces, requires_braces_t<Select>::value>>;
|
||||
using _nodes = detail::type_vector<>;
|
||||
|
||||
select_pseudo_table_t(Select select) : _select(select)
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
#ifndef SQLPP_TABLE_ALIAS_H
|
||||
#define SQLPP_TABLE_ALIAS_H
|
||||
|
||||
#include <sqlpp11/column_fwd.h>
|
||||
#include <sqlpp11/interpret.h>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/join.h>
|
||||
#include <sqlpp11/alias.h>
|
||||
#include <sqlpp11/column_fwd.h>
|
||||
#include <sqlpp11/detail/type_set.h>
|
||||
#include <sqlpp11/interpret.h>
|
||||
#include <sqlpp11/join.h>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
@@ -107,10 +107,10 @@ namespace sqlpp
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
if (requires_braces_t<T>::value)
|
||||
if (requires_braces_t<Table>::value)
|
||||
context << "(";
|
||||
serialize(t._table, context);
|
||||
if (requires_braces_t<T>::value)
|
||||
if (requires_braces_t<Table>::value)
|
||||
context << ")";
|
||||
context << " AS " << name_of<T>::char_ptr();
|
||||
return context;
|
||||
|
||||
@@ -209,16 +209,17 @@ namespace sqlpp
|
||||
};
|
||||
};
|
||||
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_t, "calling where() or unconditionally() required");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_or_unconditionally_called_t,
|
||||
"calling where() or unconditionally() required");
|
||||
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_not_cpp_bool_t,
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_arg_is_not_cpp_bool_t,
|
||||
"where() argument has to be an sqlpp boolean expression. Please use "
|
||||
".unconditionally() instead of .where(true), or sqlpp::value(bool)");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_boolean_expression_t,
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_arg_is_boolean_expression_t,
|
||||
"where() argument has to be an sqlpp boolean expression.");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_no_aggregate_functions_t,
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_arg_contains_no_aggregate_functions_t,
|
||||
"at least one aggregate function used in where()");
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_dynamic_statement_dynamic_t,
|
||||
SQLPP_PORTABLE_STATIC_ASSERT(assert_where_dynamic_used_with_dynamic_statement_t,
|
||||
"dynamic_where() must not be called in a static statement");
|
||||
|
||||
// workaround for msvc bugs https://connect.microsoft.com/VisualStudio/Feedback/Details/2086629 &
|
||||
@@ -226,20 +227,22 @@ namespace sqlpp
|
||||
// template <typename... Expressions>
|
||||
// using check_where_t = static_combined_check_t<
|
||||
// static_check_t<logic::all_t<is_not_cpp_bool_t<Expressions>::value...>::value,
|
||||
// assert_where_not_cpp_bool_t>,
|
||||
// assert_where_arg_is_not_cpp_bool_t>,
|
||||
// static_check_t<logic::all_t<is_expression_t<Expressions>::value...>::value,
|
||||
// assert_where_boolean_expressions_t>,
|
||||
// static_check_t<logic::all_t<is_boolean_t<Expressions>::value...>::value, assert_where_boolean_expression_t>,
|
||||
// static_check_t<logic::all_t<is_boolean_t<Expressions>::value...>::value,
|
||||
// assert_where_arg_is_boolean_expression_t>,
|
||||
// static_check_t<logic::all_t<(not contains_aggregate_function_t<Expressions>::value)...>::value,
|
||||
// assert_where_no_aggregate_functions_t>>;
|
||||
// assert_where_arg_contains_no_aggregate_functions_t>>;
|
||||
template <typename Expression>
|
||||
struct check_where
|
||||
{
|
||||
using type = static_combined_check_t<
|
||||
static_check_t<is_not_cpp_bool_t<Expression>::value, assert_where_not_cpp_bool_t>,
|
||||
static_check_t<is_expression_t<Expression>::value, assert_where_boolean_expression_t>,
|
||||
static_check_t<is_boolean_t<Expression>::value, assert_where_boolean_expression_t>,
|
||||
static_check_t<not contains_aggregate_function_t<Expression>::value, assert_where_no_aggregate_functions_t>>;
|
||||
static_check_t<is_not_cpp_bool_t<Expression>::value, assert_where_arg_is_not_cpp_bool_t>,
|
||||
static_check_t<is_expression_t<Expression>::value, assert_where_arg_is_boolean_expression_t>,
|
||||
static_check_t<is_boolean_t<Expression>::value, assert_where_arg_is_boolean_expression_t>,
|
||||
static_check_t<not contains_aggregate_function_t<Expression>::value,
|
||||
assert_where_arg_contains_no_aggregate_functions_t>>;
|
||||
};
|
||||
|
||||
template <typename Expression>
|
||||
@@ -250,7 +253,7 @@ namespace sqlpp
|
||||
|
||||
template <typename Database, typename Expression>
|
||||
using check_where_dynamic_t = static_combined_check_t<
|
||||
static_check_t<not std::is_same<Database, void>::value, assert_where_dynamic_statement_dynamic_t>,
|
||||
static_check_t<not std::is_same<Database, void>::value, assert_where_dynamic_used_with_dynamic_statement_t>,
|
||||
check_where_t<Expression>>;
|
||||
|
||||
// NO WHERE YET
|
||||
@@ -311,7 +314,7 @@ namespace sqlpp
|
||||
|
||||
using _consistency_check =
|
||||
typename std::conditional<WhereRequired and (Policies::_all_provided_tables::size::value > 0),
|
||||
assert_where_t,
|
||||
assert_where_or_unconditionally_called_t,
|
||||
consistent_t>::type;
|
||||
|
||||
auto unconditionally() const -> _new_statement_t<consistent_t, where_t<void, unconditional_t>>
|
||||
|
||||
Reference in New Issue
Block a user