0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Cleanup some warning and includes

This commit is contained in:
Roland Bock 2021-08-01 18:39:11 +02:00
parent 68021772c2
commit d0a8ea21af
39 changed files with 55 additions and 114 deletions

View File

@ -28,7 +28,6 @@
#define SQLPP11_ALIAS_H
#include <sqlpp11/type_traits.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -30,7 +30,6 @@
#include <sqlpp11/default_value.h>
#include <sqlpp11/null.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/simple_column.h>
namespace sqlpp

View File

@ -127,7 +127,7 @@ namespace sqlpp
auto operator==(T t) const -> _new_binary_expression_t<equal_to_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>{};
check_comparison_t<Expr, rhs>::verify();
return {*static_cast<const Expr*>(this), rhs{t}};
}
@ -136,7 +136,7 @@ namespace sqlpp
auto operator!=(T t) const -> _new_binary_expression_t<not_equal_to_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>{};
check_comparison_t<Expr, rhs>::verify();
return {*static_cast<const Expr*>(this), rhs{t}};
}
@ -145,7 +145,7 @@ namespace sqlpp
auto operator<(T t) const -> _new_binary_expression_t<less_than_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>{};
check_comparison_t<Expr, rhs>::verify();
return {*static_cast<const Expr*>(this), rhs{t}};
}
@ -154,7 +154,7 @@ namespace sqlpp
auto operator<=(T t) const -> _new_binary_expression_t<less_equal_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>{};
check_comparison_t<Expr, rhs>::verify();
return {*static_cast<const Expr*>(this), rhs{t}};
}
@ -163,7 +163,7 @@ namespace sqlpp
auto operator>(T t) const -> _new_binary_expression_t<greater_than_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>{};
check_comparison_t<Expr, rhs>::verify();
return {*static_cast<const Expr*>(this), rhs{t}};
}
@ -205,98 +205,98 @@ namespace sqlpp
template <typename... T>
auto in(T... t) const -> typename _new_nary_expression<in_t, T...>::type
{
check_in_t<Expr, wrap_operand_t<T>...>{};
check_in_t<Expr, wrap_operand_t<T>...>::verify();
return {*static_cast<const Expr*>(this), typename wrap_operand<T>::type{t}...};
}
template <typename... T>
auto not_in(T... t) const -> typename _new_nary_expression<not_in_t, T...>::type
{
check_in_t<Expr, wrap_operand_t<T>...>{};
check_in_t<Expr, wrap_operand_t<T>...>::verify();
return {*static_cast<const Expr*>(this), typename wrap_operand<T>::type{t}...};
}
template <typename Defer = void>
auto operator not() const -> return_type_not_t<Expr, Defer>
{
typename return_type_not<Expr, Defer>::check{};
return_type_not<Expr, Defer>::check::verify();
return {*static_cast<const Expr*>(this)};
}
template <typename R>
auto operator and(const R& r) const -> return_type_and_t<Expr, R>
{
typename return_type_and<Expr, R>::check{};
return_type_and<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator&(const R& r) const -> return_type_bitwise_and_t<Expr, R>
{
typename return_type_bitwise_and<Expr, R>::check{};
return_type_bitwise_and<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator|(const R& r) const -> return_type_bitwise_or_t<Expr, R>
{
typename return_type_bitwise_or<Expr, R>::check{};
return_type_bitwise_or<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator or(const R& r) const -> return_type_or_t<Expr, R>
{
typename return_type_or<Expr, R>::check{};
return_type_or<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator+(const R& r) const -> return_type_plus_t<Expr, R>
{
typename return_type_plus<Expr, R>::check{};
return_type_plus<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator-(const R& r) const -> return_type_minus_t<Expr, R>
{
typename return_type_minus<Expr, R>::check{};
return_type_minus<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator*(const R& r) const -> return_type_multiplies_t<Expr, R>
{
typename return_type_multiplies<Expr, R>::check{};
return_type_multiplies<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator/(const R& r) const -> return_type_divides_t<Expr, R>
{
typename return_type_divides<Expr, R>::check{};
return_type_divides<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename R>
auto operator%(const R& r) const -> return_type_modulus_t<Expr, R>
{
typename return_type_modulus<Expr, R>::check{};
return_type_modulus<Expr, R>::check::verify();
return {*static_cast<const Expr*>(this), wrap_operand_t<R>{r}};
}
template <typename Defer = void>
auto operator+() const -> return_type_unary_plus_t<Expr, Defer>
{
typename return_type_unary_plus<Expr, Defer>::check{};
return_type_unary_plus<Expr, Defer>::check::verify();
return {*static_cast<const Expr*>(this)};
}
template <typename Defer = void>
auto operator-() const -> return_type_unary_minus_t<Expr, Defer>
{
typename return_type_unary_minus<Expr, Defer>::check{};
return_type_unary_minus<Expr, Defer>::check::verify();
return {*static_cast<const Expr*>(this)};
}
};

View File

@ -27,10 +27,17 @@
#ifndef SQLPP11_CHAR_SEQUENCE_H
#define SQLPP11_CHAR_SEQUENCE_H
#include <type_traits>
#include <sqlpp11/detail/index_sequence.h>
namespace sqlpp
{
template <typename Context>
std::integral_constant<char, '"'> get_quote_left(const Context&);
template <typename Context>
std::integral_constant<char, '"'> get_quote_right(const Context&);
template <char... Cs>
struct char_sequence
{

View File

@ -35,7 +35,6 @@
#include <sqlpp11/type_traits.h>
#include <sqlpp11/assignment.h>
#include <sqlpp11/expression.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/wrong.h>
#include <sqlpp11/detail/type_set.h>

View File

@ -33,6 +33,10 @@ namespace sqlpp
{
struct consistent_t : std::true_type
{
template <typename... T>
static constexpr void verify(T&&...)
{
}
};
} // namespace sqlpp

View File

@ -92,14 +92,14 @@ namespace sqlpp
template <typename Db>
auto _run(Db& db) const -> decltype(std::declval<_methods_t>()._run(db, *this))
{
_run_check{}; // FIXME: dispatch here?
_run_check::verify();
return _methods_t::_run(db, *this);
}
template <typename Db>
auto _prepare(Db& db) const -> decltype(std::declval<_methods_t>()._prepare(db, *this))
{
_prepare_check{}; // FIXME: dispatch here?
_prepare_check::verify();
return _methods_t::_prepare(db, *this);
}
@ -123,7 +123,7 @@ namespace sqlpp
};
template <typename Context, typename Database, typename... Parts>
Context serialize(const custom_query_t<Database, Parts...>& t, Context& context)
Context& serialize(const custom_query_t<Database, Parts...>& t, Context& context)
{
interpret_tuple_without_braces(t._parts, " ", context);
return context;

View File

@ -30,7 +30,6 @@
#include <vector>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -31,7 +31,6 @@
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -31,7 +31,6 @@
#include <sqlpp11/chrono.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -29,7 +29,6 @@
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -29,7 +29,6 @@
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -57,7 +57,7 @@ namespace sqlpp
template <typename R>
auto like(const R& r) const -> return_type_like_t<Expression, R>
{
typename return_type_like<Expression, R>::check{};
return_type_like<Expression, R>::check::verify();
return {*static_cast<const Expression*>(this), wrap_operand_t<R>{r}};
}
};

View File

@ -34,7 +34,6 @@
#endif
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -30,7 +30,6 @@
#include <sqlpp11/chrono.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -30,7 +30,6 @@
#include <sqlpp11/chrono.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -29,7 +29,6 @@
#include <sqlpp11/type_traits.h>
#include <sqlpp11/alias_operators.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -121,35 +121,35 @@ namespace sqlpp
template <typename Table>
auto dynamic_join(Table table) -> make_dynamic_pre_join_t<inner_join_t, Table>
{
check_dynamic_pre_join_t<Table>{}; // FIXME: Failure return type?
check_dynamic_pre_join_t<Table>::verify(); // FIXME: Failure return type?
return {table};
}
template <typename Table>
auto dynamic_inner_join(Table table) -> make_dynamic_pre_join_t<inner_join_t, Table>
{
check_dynamic_pre_join_t<Table>{};
check_dynamic_pre_join_t<Table>::verify();
return {table};
}
template <typename Table>
auto dynamic_left_outer_join(Table table) -> make_dynamic_pre_join_t<left_outer_join_t, Table>
{
check_dynamic_pre_join_t<Table>{};
check_dynamic_pre_join_t<Table>::verify();
return {table};
}
template <typename Table>
auto dynamic_right_outer_join(Table table) -> make_dynamic_pre_join_t<right_outer_join_t, Table>
{
check_dynamic_pre_join_t<Table>{};
check_dynamic_pre_join_t<Table>::verify();
return {table};
}
template <typename Table>
auto dynamic_outer_join(Table table) -> make_dynamic_pre_join_t<outer_join_t, Table>
{
check_dynamic_pre_join_t<Table>{};
check_dynamic_pre_join_t<Table>::verify();
return {table};
}

View File

@ -31,7 +31,6 @@
#include <sqlpp11/data_types/boolean.h>
#include <sqlpp11/expression_fwd.h>
#include <sqlpp11/noop.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/wrap_operand.h>
namespace sqlpp

View File

@ -27,8 +27,6 @@
#ifndef SQLPP11_HIDDEN_H
#define SQLPP11_HIDDEN_H
#include <sqlpp11/serializer.h>
namespace sqlpp
{
template <typename Clause>

View File

@ -72,12 +72,12 @@ namespace sqlpp
std::tuple<Args...> _args;
};
template <typename Context, typename Operand, typename... Args>
Context& serialize(const in_t<Operand, Args...>& t, Context& context)
template <typename Context, typename Operand, typename Arg, typename... Args>
Context& serialize(const in_t<Operand, Arg, Args...>& t, Context& context)
{
serialize(t._operand, context);
context << " IN(";
if (sizeof...(Args) == 1)
if (sizeof...(Args) == 0)
{
serialize(std::get<0>(t._args), context);
}

View File

@ -31,7 +31,6 @@
#include <sqlpp11/null.h>
#include <sqlpp11/value_or_null.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/detail/type_set.h>
namespace sqlpp

View File

@ -31,7 +31,6 @@
#include <sqlpp11/detail/type_set.h>
#include <sqlpp11/no_data.h>
#include <sqlpp11/prepared_insert.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/statement_fwd.h>
#include <sqlpp11/type_traits.h>

View File

@ -27,9 +27,6 @@
#ifndef SQLPP11_NO_DATA_H
#define SQLPP11_NO_DATA_H
#include <type_traits>
#include <sqlpp11/serializer.h>
namespace sqlpp
{
struct no_data_t

View File

@ -29,7 +29,6 @@
#include <type_traits>
#include <sqlpp11/data_types/no_value.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/prepared_execute.h>
namespace sqlpp

View File

@ -72,12 +72,12 @@ namespace sqlpp
std::tuple<Args...> _args;
};
template <typename Context, typename Operand, typename... Args>
Context& serialize(const not_in_t<Operand, Args...>& t, Context& context)
template <typename Context, typename Operand, typename Arg, typename... Args>
Context& serialize(const not_in_t<Operand, Arg, Args...>& t, Context& context)
{
serialize_operand(t._operand, context);
context << " NOT IN(";
if (sizeof...(Args) == 1)
if (sizeof...(Args) == 0)
{
serialize(std::get<0>(t._args), context);
}

View File

@ -28,7 +28,6 @@
#define SQLPP11_OVER_H
#include <sqlpp11/type_traits.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{

View File

@ -36,7 +36,12 @@ namespace sqlpp
struct name : std::false_type \
{ \
template <typename... T> \
explicit name(T&&...) \
constexpr explicit name(T&&...) \
{ \
static_assert(wrong_t<T...>::value, message); \
} \
template <typename... T> \
static constexpr void verify(T&&...) \
{ \
static_assert(wrong_t<T...>::value, message); \
} \

View File

@ -176,7 +176,7 @@ namespace sqlpp
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>{};
check_pre_join_t<Lhs, Rhs>::verify();
return {from_table(lhs), from_table(rhs)};
}

View File

@ -29,9 +29,6 @@
#include <string>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{
struct schema_t

View File

@ -245,7 +245,7 @@ namespace sqlpp
template <typename AliasProvider>
_alias_t<AliasProvider> as(const AliasProvider& aliasProvider) const
{
consistency_check_t<_statement_t>{};
consistency_check_t<_statement_t>::verify();
static_assert(_statement_t::_can_be_used_as_table(),
"statement cannot be used as table, e.g. due to missing tables");
return _table_t<AliasProvider>(_get_statement()).as(aliasProvider);

View File

@ -27,7 +27,6 @@
#ifndef SQLPP11_SERIALIZE_H
#define SQLPP11_SERIALIZE_H
#include <sqlpp11/serializer.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2013-2015, 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 SQLPP11_SERIALIZER_H
#define SQLPP11_SERIALIZER_H
#include <type_traits>
namespace sqlpp
{
// FIXME: Move to type_traits.h, for instance
template <typename Context>
std::integral_constant<char, '"'> get_quote_left(const Context&);
template <typename Context>
std::integral_constant<char, '"'> get_quote_right(const Context&);
} // namespace sqlpp
#endif

View File

@ -27,7 +27,6 @@
#ifndef SQLPP11_SIMPLE_COLUMN_H
#define SQLPP11_SIMPLE_COLUMN_H
#include <sqlpp11/serializer.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp

View File

@ -31,7 +31,6 @@
#include <sqlpp11/detail/type_set.h>
#include <sqlpp11/no_data.h>
#include <sqlpp11/prepared_insert.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/type_traits.h>
namespace sqlpp

View File

@ -33,7 +33,6 @@
#include <sqlpp11/prepared_select.h>
#include <sqlpp11/result.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/detail/get_first.h>
#include <sqlpp11/detail/get_last.h>
@ -237,14 +236,14 @@ namespace sqlpp
template <typename Database>
auto _run(Database& db) const -> decltype(std::declval<_result_methods_t<statement_t>>()._run(db))
{
_run_check{}; // FIXME: Dispatch?
_run_check::verify();
return _result_methods_t<statement_t>::_run(db);
}
template <typename Database>
auto _prepare(Database& db) const -> decltype(std::declval<_result_methods_t<statement_t>>()._prepare(db))
{
_prepare_check{}; // FIXME: Dispatch?
_prepare_check::verify();
return _result_methods_t<statement_t>::_prepare(db);
}
};

View File

@ -31,7 +31,6 @@
#include <tuple>
#include <sqlpp11/consistent.h>
#include <sqlpp11/portable_static_assert.h>
#include <sqlpp11/serializer.h>
#include <sqlpp11/detail/type_vector.h>
#include <sqlpp11/detail/type_set.h>
#include <sqlpp11/detail/void.h>

View File

@ -27,8 +27,6 @@
#ifndef SQLPP11_UNION_DATA_H
#define SQLPP11_UNION_DATA_H
#include <sqlpp11/serializer.h>
namespace sqlpp
{
template <typename Database, typename Flag, typename Lhs, typename Rhs>

View File

@ -28,7 +28,6 @@
*/
#include <sqlpp11/type_traits.h>
#include <sqlpp11/serializer.h>
namespace sqlpp
{