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

SelectTest compiles again

This commit is contained in:
rbock 2014-06-02 06:40:22 +02:00
parent b00fe51fed
commit 3fb6c6c246
8 changed files with 18 additions and 11 deletions

View File

@ -62,6 +62,7 @@ namespace sqlpp
template<typename Db = void, typename... Policies> template<typename Db = void, typename... Policies>
struct select_policies_t struct select_policies_t
{ {
#warning need to check policies' signature, e.g. a _data_t in _member_t template
using _database_t = Db; using _database_t = Db;
using _statement_t = select_t<Db, Policies...>; using _statement_t = select_t<Db, Policies...>;

View File

@ -73,7 +73,7 @@ namespace sqlpp
static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in group_by()"); static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in group_by()");
// Data // Data
using _data_t = select_flag_list_data_t<Database, Expressions...>; using _data_t = group_by_data_t<Database, Expressions...>;
// Member implementation with data and methods // Member implementation with data and methods
template<typename Policies> template<typename Policies>

View File

@ -75,6 +75,8 @@ namespace sqlpp
template<typename Policies> template<typename Policies>
struct _member_t struct _member_t
{ {
using _data_t = limit_data_t<Limit>;
_impl_t<Policies> limit; _impl_t<Policies> limit;
_impl_t<Policies>& operator()() { return limit; } _impl_t<Policies>& operator()() { return limit; }
const _impl_t<Policies>& operator()() const { return limit; } const _impl_t<Policies>& operator()() const { return limit; }
@ -126,7 +128,7 @@ namespace sqlpp
using _recursive_traits = make_recursive_traits<>; using _recursive_traits = make_recursive_traits<>;
// Data // Data
using _data_t = limit_data_t<Database>; using _data_t = dynamic_limit_data_t<Database>;
// Member implementation with data and methods // Member implementation with data and methods
template <typename Policies> template <typename Policies>
@ -148,6 +150,8 @@ namespace sqlpp
template<typename Policies> template<typename Policies>
struct _member_t struct _member_t
{ {
using _data_t = dynamic_limit_data_t<Database>;
_impl_t<Policies> limit; _impl_t<Policies> limit;
_impl_t<Policies>& operator()() { return limit; } _impl_t<Policies>& operator()() { return limit; }
const _impl_t<Policies>& operator()() const { return limit; } const _impl_t<Policies>& operator()() const { return limit; }

View File

@ -75,6 +75,8 @@ namespace sqlpp
template<typename Policies> template<typename Policies>
struct _member_t struct _member_t
{ {
using _data_t = offset_data_t<Offset>;
_impl_t<Policies> offset; _impl_t<Policies> offset;
_impl_t<Policies>& operator()() { return offset; } _impl_t<Policies>& operator()() { return offset; }
const _impl_t<Policies>& operator()() const { return offset; } const _impl_t<Policies>& operator()() const { return offset; }
@ -126,7 +128,7 @@ namespace sqlpp
using _recursive_traits = make_recursive_traits<>; using _recursive_traits = make_recursive_traits<>;
// Data // Data
using _data_t = offset_data_t<Database>; using _data_t = dynamic_offset_data_t<Database>;
// Member implementation with data and methods // Member implementation with data and methods
template <typename Policies> template <typename Policies>
@ -148,6 +150,8 @@ namespace sqlpp
template<typename Policies> template<typename Policies>
struct _member_t struct _member_t
{ {
using _data_t = dynamic_offset_data_t<Database>;
_impl_t<Policies> offset; _impl_t<Policies> offset;
_impl_t<Policies>& operator()() { return offset; } _impl_t<Policies>& operator()() { return offset; }
const _impl_t<Policies>& operator()() const { return offset; } const _impl_t<Policies>& operator()() const { return offset; }

View File

@ -73,7 +73,7 @@ namespace sqlpp
static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in order_by()"); static_assert(::sqlpp::detail::all_t<is_expression_t<Expressions>::value...>::value, "at least one argument is not an expression in order_by()");
// Data // Data
using _data_t = select_flag_list_data_t<Database, Expressions...>; using _data_t = order_by_data_t<Database, Expressions...>;
// Member implementation with data and methods // Member implementation with data and methods
template<typename Policies> template<typename Policies>

View File

@ -98,7 +98,7 @@ namespace sqlpp
template<typename Flag> template<typename Flag>
void _add_impl(Flag flag, const std::true_type&) void _add_impl(Flag flag, const std::true_type&)
{ {
return static_cast<typename Policies::_statement_t*>(this)->_select_flag_list()._dynamic_flags.emplace_back(flag); return _data._dynamic_flags.emplace_back(flag);
} }
template<typename Flag> template<typename Flag>

View File

@ -77,8 +77,6 @@ namespace sqlpp
template <typename Policies> template <typename Policies>
struct _impl_t struct _impl_t
{ {
using _data_t = where_data_t<Database, Expressions...>;
template<typename Expression> template<typename Expression>
void add_ntc(Expression expression) void add_ntc(Expression expression)
{ {
@ -115,6 +113,8 @@ namespace sqlpp
template<typename Policies> template<typename Policies>
struct _member_t struct _member_t
{ {
using _data_t = where_data_t<Database, Expressions...>;
_impl_t<Policies> where; _impl_t<Policies> where;
_impl_t<Policies>& operator()() { return where; } _impl_t<Policies>& operator()() { return where; }
const _impl_t<Policies>& operator()() const { return where; } const _impl_t<Policies>& operator()() const { return where; }

View File

@ -55,7 +55,6 @@ int main()
int64_t a = row.alpha; int64_t a = row.alpha;
const std::string b = row.beta; const std::string b = row.beta;
} }
#if 0
for (const auto& row : db(select(all_of(t).as(t)).from(t).where(true))) for (const auto& row : db(select(all_of(t).as(t)).from(t).where(true)))
{ {
@ -70,7 +69,8 @@ int main()
const bool g = row.gamma; const bool g = row.gamma;
} }
auto s = dynamic_select(db).dynamic_columns(all_of(t)).dynamic_flags().dynamic_from(t).extra_tables(f,t).dynamic_where()/*.dynamic_group_by(t.alpha).dynamic_order_by().dynamic_having(t.gamma).dynamic_limit().dynamic_offset()*/; auto stat = sqlpp::select().columns(all_of(t)).flags(sqlpp::all).from(t).extra_tables(f,t).where(t.alpha > 0).group_by(t.alpha).order_by(t.gamma.asc()).having(t.gamma).limit(7).offset(19);
auto s = dynamic_select(db).dynamic_columns(all_of(t)).dynamic_flags().dynamic_from(t).extra_tables(f,t).dynamic_where().dynamic_group_by(t.alpha).dynamic_order_by().dynamic_having(t.gamma).dynamic_limit().dynamic_offset();
s.select_flags.add(sqlpp::distinct); s.select_flags.add(sqlpp::distinct);
s.selected_columns.add(f.omega); s.selected_columns.add(f.omega);
s.from.add(f); s.from.add(f);
@ -85,9 +85,7 @@ int main()
int64_t a = row.alpha; int64_t a = row.alpha;
} }
auto X = select(all_of(t)).from(t).as(t.alpha); auto X = select(all_of(t)).from(t).as(t.alpha);
#endif
return 0; return 0;
} }