Added table() method for columns.

This commit is contained in:
rbock
2015-03-07 09:40:06 +01:00
parent 028af83fe7
commit 6591d38bab
2 changed files with 19 additions and 0 deletions

View File

@@ -36,11 +36,23 @@
MockDb db = {};
MockDb::_serializer_context_t printer;
template<typename Column>
int64_t getColumn(const Column& column)
{
auto result = db(select(column.as(sqlpp::a)).from(column.table()).where(true));
if (not result.empty())
return result.front().a;
else
return 0;
}
int main()
{
test::TabFoo f;
test::TabBar t;
getColumn(t.alpha);
for (const auto& row : db(select(all_of(t)).from(t).where(true)))
{
int64_t a = row.alpha;