mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-01 10:41:22 -06:00
Added derived_statement_t alias
This commit is contained in:
@@ -148,7 +148,7 @@ namespace sqlpp
|
||||
auto extra_tables(Args...) const
|
||||
-> _new_statement_t<extra_tables_t<Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), extra_tables_data_t<Args...>{} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), extra_tables_data_t<Args...>{} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace sqlpp
|
||||
static_assert(_number_of_tables == _unique_tables::size::value, "at least one duplicate table detected in from()");
|
||||
static_assert(_number_of_tables == _unique_table_names::size::value, "at least one duplicate table name detected in from()");
|
||||
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), from_data_t<Database, Tables...>{tables...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), from_data_t<Database, Tables...>{tables...} };
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace sqlpp
|
||||
auto group_by(Args... args) const
|
||||
-> _new_statement_t<group_by_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), group_by_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), group_by_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -186,7 +186,7 @@ namespace sqlpp
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), group_by_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), group_by_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace sqlpp
|
||||
auto having(Args... args) const
|
||||
-> _new_statement_t<having_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), having_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), having_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -184,7 +184,7 @@ namespace sqlpp
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), having_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), having_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace sqlpp
|
||||
template<typename Policies>
|
||||
struct _result_methods_t
|
||||
{
|
||||
using _statement_t = typename Policies::_statement_t;
|
||||
using _statement_t = derived_statement_t<Policies>;
|
||||
|
||||
const _statement_t& _get_statement() const
|
||||
{
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace sqlpp
|
||||
auto default_values() const
|
||||
-> _new_statement_t<insert_default_values_t>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), insert_default_values_data_t{} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), insert_default_values_data_t{} };
|
||||
}
|
||||
|
||||
template<typename... Columns>
|
||||
@@ -358,7 +358,7 @@ namespace sqlpp
|
||||
using set_columns = detail::make_type_set_t<Columns...>;
|
||||
static_assert(detail::is_subset_of<required_columns, set_columns>::value, "At least one required column is missing in columns()");
|
||||
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), column_list_data_t<Columns...>{columns...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), column_list_data_t<Columns...>{columns...} };
|
||||
}
|
||||
|
||||
template<typename... Assignments>
|
||||
@@ -394,7 +394,7 @@ namespace sqlpp
|
||||
using _column_required_tables = ::sqlpp::detail::make_joined_set_t<required_tables_of<lhs_t<Assignments>>...>;
|
||||
static_assert(sizeof...(Assignments) ? (_column_required_tables::size::value == 1) : true, "set() contains assignments for columns from several tables");
|
||||
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), insert_list_data_t<Database, Assignments...>{assignments...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), insert_list_data_t<Database, Assignments...>{assignments...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace sqlpp
|
||||
auto into(Args... args) const
|
||||
-> _new_statement_t<into_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), into_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), into_data_t<void, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -215,14 +215,14 @@ namespace sqlpp
|
||||
auto limit(Arg arg) const
|
||||
-> _new_statement_t<limit_t<typename wrap_operand<Arg>::type>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), limit_data_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), limit_data_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||
}
|
||||
|
||||
auto dynamic_limit() const
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), dynamic_limit_data_t<_database_t>{} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), dynamic_limit_data_t<_database_t>{} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -172,8 +172,8 @@ namespace sqlpp
|
||||
{
|
||||
// FIXME: Make sure that Offset does not require external tables? Need to read up on SQL
|
||||
using arg_t = typename wrap_operand<Offset>::type;
|
||||
static_cast<typename Policies::_statement_t*>(this)->_offset()._value = arg_t{value};
|
||||
static_cast<typename Policies::_statement_t*>(this)->_offset()._initialized = true;
|
||||
static_cast<derived_statement_t<Policies>*>(this)->_offset()._value = arg_t{value};
|
||||
static_cast<derived_statement_t<Policies>*>(this)->_offset()._initialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -226,14 +226,14 @@ namespace sqlpp
|
||||
auto offset(Arg arg) const
|
||||
-> _new_statement_t<offset_t<typename wrap_operand<Arg>::type>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), offset_data_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), offset_data_t<typename wrap_operand<Arg>::type>{{arg}} };
|
||||
}
|
||||
|
||||
auto dynamic_offset() const
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), dynamic_offset_data_t<_database_t>{} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), dynamic_offset_data_t<_database_t>{} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace sqlpp
|
||||
auto order_by(Args... args) const
|
||||
-> _new_statement_t<order_by_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), order_by_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), order_by_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -186,7 +186,7 @@ namespace sqlpp
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), order_by_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), order_by_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace sqlpp
|
||||
template<typename Policies>
|
||||
struct _result_methods_t
|
||||
{
|
||||
using _statement_t = typename Policies::_statement_t;
|
||||
using _statement_t = derived_statement_t<Policies>;
|
||||
|
||||
const _statement_t& _get_statement() const
|
||||
{
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace sqlpp
|
||||
template<typename Policies>
|
||||
struct _result_methods_t
|
||||
{
|
||||
using _statement_t = typename Policies::_statement_t;
|
||||
using _statement_t = derived_statement_t<Policies>;
|
||||
|
||||
const _statement_t& _get_statement() const
|
||||
{
|
||||
@@ -372,7 +372,7 @@ namespace sqlpp
|
||||
auto columns(Args... args) const
|
||||
-> _new_statement_t<::sqlpp::detail::make_select_column_list_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), typename ::sqlpp::detail::make_select_column_list_t<void, Args...>::_data_t{std::tuple_cat(::sqlpp::detail::as_tuple<Args>::_(args)...)} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), typename ::sqlpp::detail::make_select_column_list_t<void, Args...>::_data_t{std::tuple_cat(::sqlpp::detail::as_tuple<Args>::_(args)...)} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -380,7 +380,7 @@ namespace sqlpp
|
||||
-> _new_statement_t<::sqlpp::detail::make_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), typename ::sqlpp::detail::make_select_column_list_t<_database_t, Args...>::_data_t{std::tuple_cat(::sqlpp::detail::as_tuple<Args>::_(args)...)} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), typename ::sqlpp::detail::make_select_column_list_t<_database_t, Args...>::_data_t{std::tuple_cat(::sqlpp::detail::as_tuple<Args>::_(args)...)} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace sqlpp
|
||||
auto flags(Args... args) const
|
||||
-> _new_statement_t<select_flag_list_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), select_flag_list_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), select_flag_list_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -185,7 +185,7 @@ namespace sqlpp
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), select_flag_list_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), select_flag_list_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace sqlpp
|
||||
auto from(Args... args) const
|
||||
-> _new_statement_t<single_table_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), single_table_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), single_table_data_t<void, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -235,6 +235,8 @@ namespace sqlpp
|
||||
template<typename NameProvider, typename Member>
|
||||
using member_t = typename NameProvider::_name_t::template _member_t<Member>;
|
||||
|
||||
template<typename Policies>
|
||||
using derived_statement_t = typename Policies::_statement_t;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace sqlpp
|
||||
template<typename Policies>
|
||||
struct _result_methods_t
|
||||
{
|
||||
using _statement_t = typename Policies::_statement_t;
|
||||
using _statement_t = derived_statement_t<Policies>;
|
||||
|
||||
const _statement_t& _get_statement() const
|
||||
{
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace sqlpp
|
||||
using _column_required_tables = ::sqlpp::detail::make_joined_set_t<required_tables_of<lhs_t<Assignments>>...>;
|
||||
static_assert(sizeof...(Assignments) ? (_column_required_tables::size::value == 1) : true, "set() contains assignments for columns from more than one table");
|
||||
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), update_list_data_t<Database, Assignments...>{assignments...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), update_list_data_t<Database, Assignments...>{assignments...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace sqlpp
|
||||
auto using_(Args... args) const
|
||||
-> _new_statement_t<using_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), using_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), using_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -179,7 +179,7 @@ namespace sqlpp
|
||||
-> _new_statement_t<using_t<_database_t, Args...>>
|
||||
{
|
||||
static_assert(not std::is_same<_database_t, void>::value, "dynamic_using must not be called in a static statement");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), using_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), using_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace sqlpp
|
||||
auto where(Args... args) const
|
||||
-> _new_statement_t<where_t<void, Args...>>
|
||||
{
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), where_data_t<void, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), where_data_t<void, Args...>{args...} };
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -241,7 +241,7 @@ namespace sqlpp
|
||||
-> _new_statement_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");
|
||||
return { *static_cast<const typename Policies::_statement_t*>(this), where_data_t<_database_t, Args...>{args...} };
|
||||
return { static_cast<const derived_statement_t<Policies>&>(*this), where_data_t<_database_t, Args...>{args...} };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user