mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-01 10:41:22 -06:00
Took care of a few warnings
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#define SQLPP_FROM_H
|
||||
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/no_data.h>
|
||||
#include <sqlpp11/interpretable_list.h>
|
||||
#include <sqlpp11/interpret_tuple.h>
|
||||
#include <sqlpp11/detail/logic.h>
|
||||
@@ -60,7 +61,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::from>;
|
||||
using _recursive_traits = make_recursive_traits<Tables...>;
|
||||
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Tables), "at least one table or join argument required in from()");
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::group_by>;
|
||||
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 = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression (e.g. a column) required in group_by()");
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::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 = is_database<Database>;
|
||||
|
||||
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()");
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::insert_list>;
|
||||
using _recursive_traits = make_recursive_traits<typename Assignments::_column_t..., typename Assignments::_value_t...>;
|
||||
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
template<template<typename...> class Target>
|
||||
using copy_assignments_t = Target<Assignments...>; // FIXME: Nice idea to copy variadic template arguments?
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/no_value.h>
|
||||
#include <sqlpp11/no_data.h>
|
||||
#include <sqlpp11/prepared_insert.h>
|
||||
#include <sqlpp11/serializer.h>
|
||||
#include <sqlpp11/detail/type_set.h>
|
||||
|
||||
@@ -33,20 +33,6 @@
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
#warning: Need extra include file for no_data
|
||||
struct no_data_t {};
|
||||
|
||||
template<typename Context>
|
||||
struct serializer_t<Context, no_data_t>
|
||||
{
|
||||
using T = no_data_t;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
return context;
|
||||
}
|
||||
};
|
||||
|
||||
struct noop
|
||||
{
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, tag::on>;
|
||||
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 = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Expr), "at least one expression argument required in on()");
|
||||
static_assert(detail::all_t<is_expression_t<Expr>::value...>::value, "at least one argument is not an expression in on()");
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::order_by>;
|
||||
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 = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression (e.g. a column) required in order_by()");
|
||||
|
||||
|
||||
@@ -129,8 +129,6 @@ namespace sqlpp
|
||||
template<typename Database, typename... Columns>
|
||||
struct select_column_list_data_t
|
||||
{
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
|
||||
select_column_list_data_t(Columns... columns):
|
||||
_columns(columns...)
|
||||
{}
|
||||
@@ -159,12 +157,11 @@ namespace sqlpp
|
||||
|
||||
using _name_t = typename ::sqlpp::detail::select_traits<Columns...>::_name_t;
|
||||
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Columns), "at least one select expression required");
|
||||
static_assert(not ::sqlpp::detail::has_duplicates<Columns...>::value, "at least one duplicate argument detected");
|
||||
|
||||
static_assert(::sqlpp::detail::all_t<(is_named_expression_t<Columns>::value or is_multi_column_t<Columns>::value)...>::value, "at least one argument is not a named expression");
|
||||
|
||||
static_assert(not ::sqlpp::detail::has_duplicates<typename Columns::_name_t...>::value, "at least one duplicate name detected");
|
||||
|
||||
struct _column_type {};
|
||||
@@ -383,9 +380,6 @@ namespace sqlpp
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
// check for at least one expression
|
||||
static_assert(T::_is_dynamic::value or sizeof...(Columns), "at least one select expression required");
|
||||
|
||||
interpret_tuple(t._columns, ',', context);
|
||||
if (sizeof...(Columns) and not t._dynamic_columns.empty())
|
||||
context << ',';
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <tuple>
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/no_data.h>
|
||||
#include <sqlpp11/select_flags.h>
|
||||
#include <sqlpp11/detail/type_set.h>
|
||||
#include <sqlpp11/interpret_tuple.h>
|
||||
@@ -61,7 +62,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::select_flag_list>;
|
||||
using _recursive_traits = make_recursive_traits<Flags...>;
|
||||
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(not ::sqlpp::detail::has_duplicates<Flags...>::value, "at least one duplicate argument detected in select flag list");
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/no_value.h>
|
||||
#include <sqlpp11/no_data.h>
|
||||
#include <sqlpp11/serializer.h>
|
||||
#include <sqlpp11/prepared_insert.h>
|
||||
#include <sqlpp11/detail/type_set.h>
|
||||
|
||||
@@ -43,8 +43,6 @@ namespace sqlpp
|
||||
template<typename Db, typename... Policies>
|
||||
struct statement_t;
|
||||
|
||||
#warning STEPS:
|
||||
#warning deal with different return types in the connector (select could be a single value, update could be a range of rows)
|
||||
namespace detail
|
||||
{
|
||||
template<typename Db = void, typename... Policies>
|
||||
@@ -115,7 +113,7 @@ namespace sqlpp
|
||||
using _required_tables = _required_tables;
|
||||
using _provided_tables = detail::type_set<>;
|
||||
using _extra_tables = detail::type_set<>;
|
||||
using _parameters = detail::make_parameter_list_t<parameters_of<Policies>...>;
|
||||
using _parameters = detail::make_parameter_tuple_t<parameters_of<Policies>...>;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -161,9 +159,7 @@ namespace sqlpp
|
||||
|
||||
static constexpr size_t _get_static_no_of_parameters()
|
||||
{
|
||||
#warning need to fix this
|
||||
return 0;
|
||||
//return _parameter_list_t::size::value;
|
||||
return std::tuple_size<parameters_of<statement_t>>::value;
|
||||
}
|
||||
|
||||
size_t _get_no_of_parameters() const
|
||||
|
||||
@@ -126,7 +126,6 @@ namespace sqlpp
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(into);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(extra_tables);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(on);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(dynamic);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(where);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(group_by);
|
||||
SQLPP_IS_VALUE_TRAIT_GENERATOR(having);
|
||||
@@ -150,6 +149,9 @@ namespace sqlpp
|
||||
SQLPP_CONNECTOR_TRAIT_GENERATOR(null_result_is_trivial_value);
|
||||
SQLPP_CONNECTOR_TRAIT_GENERATOR(assert_result_validity);
|
||||
|
||||
template<typename Database>
|
||||
using is_database = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
|
||||
template<typename T, template<typename> class IsTag>
|
||||
using copy_type_trait = typename std::conditional<IsTag<T>::value, std::true_type, std::false_type>::type;
|
||||
|
||||
@@ -186,14 +188,13 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
struct make_parameter_list_impl
|
||||
struct make_parameter_tuple_impl
|
||||
{
|
||||
using type = decltype(std::tuple_cat(std::declval<T>()...));
|
||||
};
|
||||
|
||||
#warning this will lead to confusion with ::sqlpp::make_parameter_list_t in parameter_list.h
|
||||
template<typename... T>
|
||||
using make_parameter_list_t = typename make_parameter_list_impl<T...>::type;
|
||||
using make_parameter_tuple_t = typename make_parameter_tuple_impl<T...>::type;
|
||||
}
|
||||
template<typename T>
|
||||
using value_type_of = typename detail::value_type_of_impl<T>::type;
|
||||
@@ -222,7 +223,7 @@ namespace sqlpp
|
||||
using _required_tables = detail::make_joined_set_t<required_tables_of<Arguments>...>;
|
||||
using _provided_tables = detail::make_joined_set_t<provided_tables_of<Arguments>...>;
|
||||
using _extra_tables = detail::make_joined_set_t<extra_tables_of<Arguments>...>;
|
||||
using _parameters = detail::make_parameter_list_t<parameters_of<Arguments>...>;
|
||||
using _parameters = detail::make_parameter_tuple_t<parameters_of<Arguments>...>;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace sqlpp
|
||||
{
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::update_list>;
|
||||
using _recursive_traits = make_recursive_traits<Assignments...>;
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Assignments), "at least one assignment expression required in set()");
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::using_>;
|
||||
using _recursive_traits = make_recursive_traits<Tables...>;
|
||||
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Tables), "at least one table argument required in using()");
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ namespace sqlpp
|
||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
|
||||
using _recursive_traits = make_recursive_traits<Expressions...>;
|
||||
|
||||
#warning: is_dynamic should be using a template alias (making it easier to replace the logic)
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
using _is_dynamic = is_database<Database>;
|
||||
|
||||
static_assert(_is_dynamic::value or sizeof...(Expressions), "at least one expression argument required in where()");
|
||||
static_assert(sqlpp::detail::none_t<is_assignment_t<Expressions>::value...>::value, "at least one argument is an assignment in where()");
|
||||
|
||||
Reference in New Issue
Block a user