mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Cleaned up a bit...
This commit is contained in:
parent
db0bbd6e3f
commit
ad5584e52d
@ -51,7 +51,14 @@
|
|||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
{
|
{
|
||||||
template<typename Database = void,
|
template<typename Db,
|
||||||
|
typename... Policies
|
||||||
|
>
|
||||||
|
struct select_t;
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template<typename Db = void,
|
||||||
typename FlagList = vendor::no_select_flag_list_t,
|
typename FlagList = vendor::no_select_flag_list_t,
|
||||||
typename ColumnList = vendor::no_select_column_list_t,
|
typename ColumnList = vendor::no_select_column_list_t,
|
||||||
typename From = vendor::no_from_t,
|
typename From = vendor::no_from_t,
|
||||||
@ -62,51 +69,43 @@ namespace sqlpp
|
|||||||
typename Limit = vendor::no_limit_t,
|
typename Limit = vendor::no_limit_t,
|
||||||
typename Offset = vendor::no_offset_t
|
typename Offset = vendor::no_offset_t
|
||||||
>
|
>
|
||||||
struct select_t;
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template<typename Db,
|
|
||||||
typename FlagList,
|
|
||||||
typename ColumnList,
|
|
||||||
typename From,
|
|
||||||
typename Where,
|
|
||||||
typename GroupBy,
|
|
||||||
typename Having,
|
|
||||||
typename OrderBy,
|
|
||||||
typename Limit,
|
|
||||||
typename Offset
|
|
||||||
>
|
|
||||||
struct select_policies_t
|
struct select_policies_t
|
||||||
{
|
{
|
||||||
using _database_t = Db;
|
using _database_t = Db;
|
||||||
using _select_t = select_t<Db, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>;
|
using _flag_list_t = FlagList;
|
||||||
|
using _column_list_t = ColumnList;
|
||||||
|
using _from_t = From;
|
||||||
|
using _where_t = Where;
|
||||||
|
using _group_by_t = GroupBy;
|
||||||
|
using _having_t = Having;
|
||||||
|
using _order_by_t = OrderBy;
|
||||||
|
using _limit_t = Limit;
|
||||||
|
using _offset_t = Offset;
|
||||||
|
|
||||||
|
using _statement_t = select_t<Db, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>;
|
||||||
|
|
||||||
|
struct _methods_t:
|
||||||
|
public _flag_list_t::template _methods_t<select_policies_t>,
|
||||||
|
public _column_list_t::template _methods_t<select_policies_t>,
|
||||||
|
public _from_t::template _methods_t<select_policies_t>,
|
||||||
|
public _where_t::template _methods_t<select_policies_t>,
|
||||||
|
public _group_by_t::template _methods_t<select_policies_t>,
|
||||||
|
public _having_t::template _methods_t<select_policies_t>,
|
||||||
|
public _order_by_t::template _methods_t<select_policies_t>,
|
||||||
|
public _limit_t::template _methods_t<select_policies_t>,
|
||||||
|
public _offset_t::template _methods_t<select_policies_t>
|
||||||
|
{};
|
||||||
|
|
||||||
template<typename Needle, typename Replacement, typename... Policies>
|
template<typename Needle, typename Replacement, typename... Policies>
|
||||||
struct _policies_update_impl
|
struct _policies_update_impl
|
||||||
{
|
{
|
||||||
|
#warning: Need to make sure that Needle is in Policies!
|
||||||
using type = select_t<Db, vendor::policy_update_t<Policies, Needle, Replacement>...>;
|
using type = select_t<Db, vendor::policy_update_t<Policies, Needle, Replacement>...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Needle, typename Replacement>
|
template<typename Needle, typename Replacement>
|
||||||
using _policies_update_t = typename _policies_update_impl<Needle, Replacement, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>::type;
|
using _policies_update_t = typename _policies_update_impl<Needle, Replacement, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>::type;
|
||||||
|
|
||||||
static_assert(is_noop_t<ColumnList>::value or sqlpp::is_select_column_list_t<ColumnList>::value, "column list of select is neither naught nor a valid column list");
|
|
||||||
static_assert(is_noop_t<From>::value or sqlpp::is_from_t<From>::value, "from() part of select is neither naught nor a valid from()");
|
|
||||||
using _value_type = typename std::conditional<
|
|
||||||
sqlpp::is_from_t<From>::value,
|
|
||||||
typename ColumnList::_value_type,
|
|
||||||
no_value_t // If there is no from, the select is not complete (this logic is a bit simple, but better than nothing)
|
|
||||||
>::type;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template<
|
|
||||||
typename ColumnList,
|
|
||||||
typename From
|
|
||||||
>
|
|
||||||
struct select_helper_t
|
|
||||||
{
|
|
||||||
static_assert(is_noop_t<ColumnList>::value or sqlpp::is_select_column_list_t<ColumnList>::value, "column list of select is neither naught nor a valid column list");
|
static_assert(is_noop_t<ColumnList>::value or sqlpp::is_select_column_list_t<ColumnList>::value, "column list of select is neither naught nor a valid column list");
|
||||||
static_assert(is_noop_t<From>::value or sqlpp::is_from_t<From>::value, "from() part of select is neither naught nor a valid from()");
|
static_assert(is_noop_t<From>::value or sqlpp::is_from_t<From>::value, "from() part of select is neither naught nor a valid from()");
|
||||||
using _value_type = typename std::conditional<
|
using _value_type = typename std::conditional<
|
||||||
@ -118,53 +117,39 @@ namespace sqlpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SELECT
|
// SELECT
|
||||||
template<typename Database,
|
template<typename Db,
|
||||||
typename FlagList,
|
typename... Policies
|
||||||
typename ColumnList,
|
|
||||||
typename From,
|
|
||||||
typename Where,
|
|
||||||
typename GroupBy,
|
|
||||||
typename Having,
|
|
||||||
typename OrderBy,
|
|
||||||
typename Limit,
|
|
||||||
typename Offset
|
|
||||||
>
|
>
|
||||||
struct select_t: public detail::select_helper_t<ColumnList, From>::_value_type::template expression_operators<select_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
struct select_t:
|
||||||
FlagList::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
public detail::select_policies_t<Db, Policies...>::_value_type::template expression_operators<select_t<Db, Policies...>>,
|
||||||
ColumnList::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
public detail::select_policies_t<Db, Policies...>::_methods_t
|
||||||
From::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
Where::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
GroupBy::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
Having::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
OrderBy::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
Limit::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>,
|
|
||||||
Offset::template _methods_t<detail::select_policies_t<Database, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>>
|
|
||||||
{
|
{
|
||||||
using _database_t = Database;
|
using _policies_t = typename detail::select_policies_t<Db, Policies...>;
|
||||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
using _database_t = typename _policies_t::_database_t;
|
||||||
|
using _flag_list_t = typename _policies_t::_flag_list_t;
|
||||||
|
using _column_list_t = typename _policies_t::_column_list_t;
|
||||||
|
using _from_t = typename _policies_t::_from_t;
|
||||||
|
using _where_t = typename _policies_t::_where_t;
|
||||||
|
using _group_by_t = typename _policies_t::_group_by_t;
|
||||||
|
using _having_t = typename _policies_t::_having_t;
|
||||||
|
using _order_by_t = typename _policies_t::_order_by_t;
|
||||||
|
using _limit_t = typename _policies_t::_limit_t;
|
||||||
|
using _offset_t = typename _policies_t::_offset_t;
|
||||||
|
|
||||||
template<typename Needle, typename Replacement, typename... Policies>
|
using _is_dynamic = typename std::conditional<std::is_same<_database_t, void>::value, std::false_type, std::true_type>::type;
|
||||||
struct _policies_update_impl
|
|
||||||
{
|
|
||||||
using type = select_t<Database, vendor::policy_update_t<Policies, Needle, Replacement>...>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Needle, typename Replacement>
|
using _parameter_tuple_t = std::tuple<Policies...>;
|
||||||
using _policies_update_t = typename _policies_update_impl<Needle, Replacement, FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>::type;
|
|
||||||
|
|
||||||
using _parameter_tuple_t = std::tuple<FlagList, ColumnList, From, Where, GroupBy, Having, OrderBy, Limit, Offset>;
|
|
||||||
using _parameter_list_t = typename make_parameter_list_t<select_t>::type;
|
using _parameter_list_t = typename make_parameter_list_t<select_t>::type;
|
||||||
using _table_set = ::sqlpp::detail::type_set<>;
|
using _table_set = ::sqlpp::detail::type_set<>;
|
||||||
|
|
||||||
using _column_list_t = ColumnList;
|
template<typename Database>
|
||||||
template<typename Db>
|
using _result_row_t = typename _column_list_t::template _result_row_t<Database>;
|
||||||
using _result_row_t = typename _column_list_t::template _result_row_t<Db>;
|
|
||||||
using _dynamic_names_t = typename _column_list_t::_dynamic_names_t;
|
using _dynamic_names_t = typename _column_list_t::_dynamic_names_t;
|
||||||
|
|
||||||
using _is_select = std::true_type;
|
using _is_select = std::true_type;
|
||||||
using _requires_braces = std::true_type;
|
using _requires_braces = std::true_type;
|
||||||
|
|
||||||
using _value_type = typename detail::select_helper_t<ColumnList, From>::_value_type;
|
using _value_type = typename detail::select_policies_t<Db, Policies...>::_value_type;
|
||||||
using _name_t = typename _column_list_t::_name_t;
|
using _name_t = typename _column_list_t::_name_t;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -173,15 +158,15 @@ namespace sqlpp
|
|||||||
|
|
||||||
template<typename Statement, typename T>
|
template<typename Statement, typename T>
|
||||||
select_t(Statement s, T t):
|
select_t(Statement s, T t):
|
||||||
_flag_list(detail::arg_selector<FlagList>::_(s._flag_list, t)),
|
_flag_list(detail::arg_selector<_flag_list_t>::_(s._flag_list, t)),
|
||||||
_column_list(detail::arg_selector<ColumnList>::_(s._column_list, t)),
|
_column_list(detail::arg_selector<_column_list_t>::_(s._column_list, t)),
|
||||||
_from(detail::arg_selector<From>::_(s._from, t)),
|
_from(detail::arg_selector<_from_t>::_(s._from, t)),
|
||||||
_where(detail::arg_selector<Where>::_(s._where, t)),
|
_where(detail::arg_selector<_where_t>::_(s._where, t)),
|
||||||
_group_by(detail::arg_selector<GroupBy>::_(s._group_by, t)),
|
_group_by(detail::arg_selector<_group_by_t>::_(s._group_by, t)),
|
||||||
_having(detail::arg_selector<Having>::_(s._having, t)),
|
_having(detail::arg_selector<_having_t>::_(s._having, t)),
|
||||||
_order_by(detail::arg_selector<OrderBy>::_(s._order_by, t)),
|
_order_by(detail::arg_selector<_order_by_t>::_(s._order_by, t)),
|
||||||
_limit(detail::arg_selector<Limit>::_(s._limit, t)),
|
_limit(detail::arg_selector<_limit_t>::_(s._limit, t)),
|
||||||
_offset(detail::arg_selector<Offset>::_(s._offset, t))
|
_offset(detail::arg_selector<_offset_t>::_(s._offset, t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
select_t(const select_t& r) = default;
|
select_t(const select_t& r) = default;
|
||||||
@ -240,46 +225,46 @@ namespace sqlpp
|
|||||||
template<typename A>
|
template<typename A>
|
||||||
struct is_table_subset_of_from
|
struct is_table_subset_of_from
|
||||||
{
|
{
|
||||||
static constexpr bool value = ::sqlpp::detail::is_subset_of<typename A::_table_set, typename From::_table_set>::value;
|
static constexpr bool value = ::sqlpp::detail::is_subset_of<typename A::_table_set, typename _from_t::_table_set>::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
template<typename Db>
|
template<typename Database>
|
||||||
auto _run(Db& db) const
|
auto _run(Database& db) const
|
||||||
-> result_t<decltype(db.select(*this)), _result_row_t<Db>>
|
-> result_t<decltype(db.select(*this)), _result_row_t<Database>>
|
||||||
{
|
{
|
||||||
#warning: need to check in add_xy method as well
|
#warning: need to check in add_xy method as well
|
||||||
#warning: need add_wxy_without_table_check
|
#warning: need add_wxy_without_table_check
|
||||||
#warning: might want to add an .extra_tables() method to say which tables might also be used here, say via dynamic_from or because this is a subselect
|
#warning: might want to add an .extra_tables() method to say which tables might also be used here, say via dynamic_from or because this is a subselect
|
||||||
static_assert(is_table_subset_of_from<ColumnList>::value, "selected columns require additional tables in from()");
|
static_assert(is_table_subset_of_from<_column_list_t>::value, "selected columns require additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<Where>::value, "where() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_where_t>::value, "where() expression requires additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<GroupBy>::value, "group_by() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_group_by_t>::value, "group_by() expression requires additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<Having>::value, "having() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_having_t>::value, "having() expression requires additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<OrderBy>::value, "order_by() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_order_by_t>::value, "order_by() expression requires additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<Limit>::value, "limit() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_limit_t>::value, "limit() expression requires additional tables in from()");
|
||||||
static_assert(is_table_subset_of_from<Offset>::value, "offset() expression requires additional tables in from()");
|
static_assert(is_table_subset_of_from<_offset_t>::value, "offset() expression requires additional tables in from()");
|
||||||
static_assert(_get_static_no_of_parameters() == 0, "cannot run select directly with parameters, use prepare instead");
|
static_assert(_get_static_no_of_parameters() == 0, "cannot run select directly with parameters, use prepare instead");
|
||||||
return {db.select(*this), get_dynamic_names()};
|
return {db.select(*this), get_dynamic_names()};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
template<typename Db>
|
template<typename Database>
|
||||||
auto _prepare(Db& db) const
|
auto _prepare(Database& db) const
|
||||||
-> prepared_select_t<Db, select_t>
|
-> prepared_select_t<Database, select_t>
|
||||||
{
|
{
|
||||||
|
|
||||||
return {{}, get_dynamic_names(), db.prepare_select(*this)};
|
return {{}, get_dynamic_names(), db.prepare_select(*this)};
|
||||||
}
|
}
|
||||||
|
|
||||||
FlagList _flag_list;
|
_flag_list_t _flag_list;
|
||||||
ColumnList _column_list;
|
_column_list_t _column_list;
|
||||||
From _from;
|
_from_t _from;
|
||||||
Where _where;
|
_where_t _where;
|
||||||
GroupBy _group_by;
|
_group_by_t _group_by;
|
||||||
Having _having;
|
_having_t _having;
|
||||||
OrderBy _order_by;
|
_order_by_t _order_by;
|
||||||
Limit _limit;
|
_limit_t _limit;
|
||||||
Offset _offset;
|
_offset_t _offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace vendor
|
namespace vendor
|
||||||
@ -308,17 +293,8 @@ namespace sqlpp
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Database>
|
template<typename Database, typename... Policies>
|
||||||
using blank_select_t = select_t<Database,
|
using make_select_t = typename detail::select_policies_t<Database, Policies...>::_statement_t;
|
||||||
vendor::no_select_flag_list_t,
|
|
||||||
vendor::no_select_column_list_t,
|
|
||||||
vendor::no_from_t,
|
|
||||||
vendor::no_where_t,
|
|
||||||
vendor::no_group_by_t,
|
|
||||||
vendor::no_having_t,
|
|
||||||
vendor::no_order_by_t,
|
|
||||||
vendor::no_limit_t,
|
|
||||||
vendor::no_offset_t>;
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -328,29 +304,29 @@ namespace sqlpp
|
|||||||
decltype(std::tuple_cat(as_tuple<Columns>::_(std::declval<Columns>())...))>;
|
decltype(std::tuple_cat(as_tuple<Columns>::_(std::declval<Columns>())...))>;
|
||||||
}
|
}
|
||||||
|
|
||||||
select_t<void> select() // FIXME: These should be constexpr
|
make_select_t<void> select() // FIXME: These should be constexpr
|
||||||
{
|
{
|
||||||
return { select_t<void>() };
|
return { };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Columns>
|
template<typename... Columns>
|
||||||
auto select(Columns... columns)
|
auto select(Columns... columns)
|
||||||
-> select_t<void, vendor::no_select_flag_list_t, detail::make_select_column_list_t<void, Columns...>>
|
-> make_select_t<void, vendor::no_select_flag_list_t, detail::make_select_column_list_t<void, Columns...>>
|
||||||
{
|
{
|
||||||
return { select_t<void>(), detail::make_select_column_list_t<void, Columns...>(std::tuple_cat(detail::as_tuple<Columns>::_(columns)...)) };
|
return { make_select_t<void>(), detail::make_select_column_list_t<void, Columns...>(std::tuple_cat(detail::as_tuple<Columns>::_(columns)...)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Database>
|
template<typename Database>
|
||||||
select_t<Database> dynamic_select(const Database&)
|
make_select_t<Database> dynamic_select(const Database&)
|
||||||
{
|
{
|
||||||
return { select_t<Database>() };
|
return { make_select_t<Database>() };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Database, typename... Columns>
|
template<typename Database, typename... Columns>
|
||||||
auto dynamic_select(const Database&, Columns... columns)
|
auto dynamic_select(const Database&, Columns... columns)
|
||||||
-> select_t<Database, vendor::no_select_flag_list_t, detail::make_select_column_list_t<void, Columns...>>
|
-> make_select_t<Database, vendor::no_select_flag_list_t, detail::make_select_column_list_t<void, Columns...>>
|
||||||
{
|
{
|
||||||
return { select_t<Database>(), detail::make_select_column_list_t<void, Columns...>(std::tuple_cat(detail::as_tuple<Columns>::_(columns)...)) };
|
return { make_select_t<Database>(), detail::make_select_column_list_t<void, Columns...>(std::tuple_cat(detail::as_tuple<Columns>::_(columns)...)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
6
include/sqlpp11/vendor/from.h
vendored
6
include/sqlpp11/vendor/from.h
vendored
@ -72,7 +72,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
static_assert(is_table_t<Table>::value, "invalid expression argument in add_from()");
|
static_assert(is_table_t<Table>::value, "invalid expression argument in add_from()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_from._dynamic_tables.emplace_back(table);
|
return static_cast<typename Policies::_statement_t*>(this)->_from._dynamic_tables.emplace_back(table);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace sqlpp
|
|||||||
auto from(Args... args)
|
auto from(Args... args)
|
||||||
-> _new_select_t<from_t<void, Args...>>
|
-> _new_select_t<from_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), from_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), from_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -104,7 +104,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<from_t<_database_t, Args...>>
|
-> _new_select_t<from_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_from must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_from must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::from_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::from_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/group_by.h
vendored
6
include/sqlpp11/vendor/group_by.h
vendored
@ -74,7 +74,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_group_by must not be called for static group_by");
|
static_assert(_is_dynamic::value, "add_group_by must not be called for static group_by");
|
||||||
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_group_by()");
|
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_group_by()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_group_by._dynamic_expressions.emplace_back(expression);
|
return static_cast<typename Policies::_statement_t*>(this)->_group_by._dynamic_expressions.emplace_back(expression);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ namespace sqlpp
|
|||||||
auto group_by(Args... args)
|
auto group_by(Args... args)
|
||||||
-> _new_select_t<group_by_t<void, Args...>>
|
-> _new_select_t<group_by_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), group_by_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), group_by_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -107,7 +107,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<group_by_t<_database_t, Args...>>
|
-> _new_select_t<group_by_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_group_by must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_group_by must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::group_by_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::group_by_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/having.h
vendored
6
include/sqlpp11/vendor/having.h
vendored
@ -72,7 +72,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_having must not be called for static having");
|
static_assert(_is_dynamic::value, "add_having must not be called for static having");
|
||||||
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_having()");
|
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_having()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_having._dynamic_expressions.emplace_back(expression);
|
return static_cast<typename Policies::_statement_t*>(this)->_having._dynamic_expressions.emplace_back(expression);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace sqlpp
|
|||||||
auto having(Args... args)
|
auto having(Args... args)
|
||||||
-> _new_select_t<having_t<void, Args...>>
|
-> _new_select_t<having_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), having_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), having_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -104,7 +104,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<having_t<_database_t, Args...>>
|
-> _new_select_t<having_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_having must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_having must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::having_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::having_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
8
include/sqlpp11/vendor/limit.h
vendored
8
include/sqlpp11/vendor/limit.h
vendored
@ -94,8 +94,8 @@ namespace sqlpp
|
|||||||
void set_limit(Limit value)
|
void set_limit(Limit value)
|
||||||
{
|
{
|
||||||
using arg_t = typename wrap_operand<Limit>::type;
|
using arg_t = typename wrap_operand<Limit>::type;
|
||||||
static_cast<typename Policies::_select_t*>(this)->_limit._value = arg_t{value};
|
static_cast<typename Policies::_statement_t*>(this)->_limit._value = arg_t{value};
|
||||||
static_cast<typename Policies::_select_t*>(this)->_limit._initialized = true;
|
static_cast<typename Policies::_statement_t*>(this)->_limit._initialized = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,14 +119,14 @@ namespace sqlpp
|
|||||||
auto limit(Arg arg)
|
auto limit(Arg arg)
|
||||||
-> _new_select_t<limit_t<typename wrap_operand<Arg>::type>>
|
-> _new_select_t<limit_t<typename wrap_operand<Arg>::type>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), limit_t<typename wrap_operand<Arg>::type>{{arg}} };
|
return { *static_cast<typename Policies::_statement_t*>(this), limit_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dynamic_limit()
|
auto dynamic_limit()
|
||||||
-> _new_select_t<dynamic_limit_t<_database_t>>
|
-> _new_select_t<dynamic_limit_t<_database_t>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_limit must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_limit must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), dynamic_limit_t<_database_t>{} };
|
return { *static_cast<typename Policies::_statement_t*>(this), dynamic_limit_t<_database_t>{} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
8
include/sqlpp11/vendor/offset.h
vendored
8
include/sqlpp11/vendor/offset.h
vendored
@ -93,8 +93,8 @@ namespace sqlpp
|
|||||||
void set_offset(Offset value)
|
void set_offset(Offset value)
|
||||||
{
|
{
|
||||||
using arg_t = typename wrap_operand<Offset>::type;
|
using arg_t = typename wrap_operand<Offset>::type;
|
||||||
static_cast<typename Policies::_select_t*>(this)->_offset._value = arg_t{value};
|
static_cast<typename Policies::_statement_t*>(this)->_offset._value = arg_t{value};
|
||||||
static_cast<typename Policies::_select_t*>(this)->_offset._initialized = true;
|
static_cast<typename Policies::_statement_t*>(this)->_offset._initialized = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,14 +118,14 @@ namespace sqlpp
|
|||||||
auto offset(Arg arg)
|
auto offset(Arg arg)
|
||||||
-> _new_select_t<offset_t<typename wrap_operand<Arg>::type>>
|
-> _new_select_t<offset_t<typename wrap_operand<Arg>::type>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), offset_t<typename wrap_operand<Arg>::type>{{arg}} };
|
return { *static_cast<typename Policies::_statement_t*>(this), offset_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dynamic_offset()
|
auto dynamic_offset()
|
||||||
-> _new_select_t<dynamic_offset_t<_database_t>>
|
-> _new_select_t<dynamic_offset_t<_database_t>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_offset must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_offset must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), dynamic_offset_t<_database_t>{} };
|
return { *static_cast<typename Policies::_statement_t*>(this), dynamic_offset_t<_database_t>{} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/order_by.h
vendored
6
include/sqlpp11/vendor/order_by.h
vendored
@ -73,7 +73,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_order_by must not be called for static order_by");
|
static_assert(_is_dynamic::value, "add_order_by must not be called for static order_by");
|
||||||
static_assert(is_sort_order_t<Expression>::value, "invalid expression argument in add_order_by()");
|
static_assert(is_sort_order_t<Expression>::value, "invalid expression argument in add_order_by()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_order_by._dynamic_expressions.emplace_back(expression);
|
return static_cast<typename Policies::_statement_t*>(this)->_order_by._dynamic_expressions.emplace_back(expression);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ namespace sqlpp
|
|||||||
auto order_by(Args... args)
|
auto order_by(Args... args)
|
||||||
-> _new_select_t<order_by_t<void, Args...>>
|
-> _new_select_t<order_by_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), order_by_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), order_by_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -105,7 +105,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<order_by_t<_database_t, Args...>>
|
-> _new_select_t<order_by_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_order_by must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_order_by must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::order_by_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::order_by_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/select_column_list.h
vendored
6
include/sqlpp11/vendor/select_column_list.h
vendored
@ -195,7 +195,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_column can only be called for dynamic_column");
|
static_assert(_is_dynamic::value, "add_column can only be called for dynamic_column");
|
||||||
static_assert(is_named_expression_t<NamedExpression>::value, "invalid named expression argument in add_column()");
|
static_assert(is_named_expression_t<NamedExpression>::value, "invalid named expression argument in add_column()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_column_list._dynamic_columns.emplace_back(namedExpression);
|
return static_cast<typename Policies::_statement_t*>(this)->_column_list._dynamic_columns.emplace_back(namedExpression);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<select_column_list_t<void, Args...>>
|
-> _new_select_t<select_column_list_t<void, Args...>>
|
||||||
{
|
{
|
||||||
#warning need to handle all_of_t here
|
#warning need to handle all_of_t here
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), select_column_list_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), select_column_list_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -240,7 +240,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<select_column_list_t<_database_t, Args...>>
|
-> _new_select_t<select_column_list_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_columns must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_columns must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::select_column_list_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::select_column_list_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/select_flag_list.h
vendored
6
include/sqlpp11/vendor/select_flag_list.h
vendored
@ -70,7 +70,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_flag must not be called for static select flags");
|
static_assert(_is_dynamic::value, "add_flag must not be called for static select flags");
|
||||||
static_assert(is_select_flag_t<Flag>::value, "invalid select flag argument in add_flag()");
|
static_assert(is_select_flag_t<Flag>::value, "invalid select flag argument in add_flag()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_flag_list._dynamic_flags.emplace_back(flag);
|
return static_cast<typename Policies::_statement_t*>(this)->_flag_list._dynamic_flags.emplace_back(flag);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ namespace sqlpp
|
|||||||
auto flags(Args... args)
|
auto flags(Args... args)
|
||||||
-> _new_select_t<select_flag_list_t<void, Args...>>
|
-> _new_select_t<select_flag_list_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), select_flag_list_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), select_flag_list_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -102,7 +102,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<select_flag_list_t<_database_t, Args...>>
|
-> _new_select_t<select_flag_list_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_flags must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_flags must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::select_flag_list_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::select_flag_list_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6
include/sqlpp11/vendor/where.h
vendored
6
include/sqlpp11/vendor/where.h
vendored
@ -73,7 +73,7 @@ namespace sqlpp
|
|||||||
static_assert(_is_dynamic::value, "add_where can only be called for dynamic_where");
|
static_assert(_is_dynamic::value, "add_where can only be called for dynamic_where");
|
||||||
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_where()");
|
static_assert(is_expression_t<Expression>::value, "invalid expression argument in add_where()");
|
||||||
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
#warning: Need to dispatch to actual add method to prevent error messages from being generated
|
||||||
return static_cast<typename Policies::_select_t*>(this)->_where._dynamic_expressions.emplace_back(expression);
|
return static_cast<typename Policies::_statement_t*>(this)->_where._dynamic_expressions.emplace_back(expression);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ namespace sqlpp
|
|||||||
auto where(Args... args)
|
auto where(Args... args)
|
||||||
-> _new_select_t<where_t<void, Args...>>
|
-> _new_select_t<where_t<void, Args...>>
|
||||||
{
|
{
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), where_t<void, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), where_t<void, Args...>{args...} };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -130,7 +130,7 @@ namespace sqlpp
|
|||||||
-> _new_select_t<where_t<_database_t, Args...>>
|
-> _new_select_t<where_t<_database_t, Args...>>
|
||||||
{
|
{
|
||||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_where must not be called in a static statement");
|
static_assert(not std::is_same<_database_t, void>::value, "dynamic_where must not be called in a static statement");
|
||||||
return { *static_cast<typename Policies::_select_t*>(this), vendor::where_t<_database_t, Args...>{args...} };
|
return { *static_cast<typename Policies::_statement_t*>(this), vendor::where_t<_database_t, Args...>{args...} };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user