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

Fixed warnings about missing initializers

This commit is contained in:
rbock 2015-05-30 16:45:06 +02:00
parent 947bf9ddd3
commit 0807e57958
3 changed files with 17 additions and 11 deletions

View File

@ -90,7 +90,7 @@ namespace sqlpp
return { _lhs, return { _lhs,
_rhs, _rhs,
{std::tuple<Expr...>{expr...}} {std::tuple<Expr...>{expr...}, {}}
}; };
} }
@ -98,35 +98,35 @@ namespace sqlpp
join_t<inner_join_t, join_t, T> join(T t) join_t<inner_join_t, join_t, T> join(T t)
{ {
static_assert(not is_noop<On>::value, "join type requires on()"); static_assert(not is_noop<On>::value, "join type requires on()");
return { *this, t }; return { *this, t, {} };
} }
template<typename T> template<typename T>
join_t<inner_join_t, join_t, T> inner_join(T t) join_t<inner_join_t, join_t, T> inner_join(T t)
{ {
static_assert(not is_noop<On>::value, "join type requires on()"); static_assert(not is_noop<On>::value, "join type requires on()");
return { *this, t }; return { *this, t, {} };
} }
template<typename T> template<typename T>
join_t<outer_join_t, join_t, T> outer_join(T t) join_t<outer_join_t, join_t, T> outer_join(T t)
{ {
static_assert(not is_noop<On>::value, "join type requires on()"); static_assert(not is_noop<On>::value, "join type requires on()");
return { *this, t }; return { *this, t, {} };
} }
template<typename T> template<typename T>
join_t<left_outer_join_t, join_t, T> left_outer_join(T t) join_t<left_outer_join_t, join_t, T> left_outer_join(T t)
{ {
static_assert(not is_noop<On>::value, "join type requires on()"); static_assert(not is_noop<On>::value, "join type requires on()");
return { *this, t }; return { *this, t, {} };
} }
template<typename T> template<typename T>
join_t<right_outer_join_t, join_t, T> right_outer_join(T t) join_t<right_outer_join_t, join_t, T> right_outer_join(T t)
{ {
static_assert(not is_noop<On>::value, "join type requires on()"); static_assert(not is_noop<On>::value, "join type requires on()");
return { *this, t }; return { *this, t, {} };
} }
Lhs _lhs; Lhs _lhs;

View File

@ -60,31 +60,31 @@ namespace sqlpp
template<typename T> template<typename T>
join_t<inner_join_t, Table, T> join(T t) const join_t<inner_join_t, Table, T> join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t, {} };
} }
template<typename T> template<typename T>
join_t<inner_join_t, Table, T> inner_join(T t) const join_t<inner_join_t, Table, T> inner_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t, {} };
} }
template<typename T> template<typename T>
join_t<outer_join_t, Table, T> outer_join(T t) const join_t<outer_join_t, Table, T> outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t, {} };
} }
template<typename T> template<typename T>
join_t<left_outer_join_t, Table, T> left_outer_join(T t) const join_t<left_outer_join_t, Table, T> left_outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t, {} };
} }
template<typename T> template<typename T>
join_t<right_outer_join_t, Table, T> right_outer_join(T t) const join_t<right_outer_join_t, Table, T> right_outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t, {} };
} }
template<typename AliasProvider> template<typename AliasProvider>

View File

@ -50,6 +50,7 @@ int Select(int, char**)
test::TabFoo f; test::TabFoo f;
test::TabBar t; test::TabBar t;
const auto tab_a = f.as(sqlpp::alias::a);
getColumn(db, t.alpha); getColumn(db, t.alpha);
@ -80,6 +81,11 @@ int Select(int, char**)
std::cout << row.alpha << std::endl; std::cout << row.alpha << std::endl;
} }
for (const auto& row : db(select(all_of(t), all_of(f)).from(t.join(f).on(t.alpha > f.omega).join(tab_a).on(t.alpha == tab_a.omega)).where(true)))
{
std::cout << row.alpha << std::endl;
}
for (const auto& row : db(select(count(t.alpha), avg(t.alpha)).from(t).where(true))) for (const auto& row : db(select(count(t.alpha), avg(t.alpha)).from(t).where(true)))
{ {
std::cout << row.count << std::endl; std::cout << row.count << std::endl;