Update existing TableViews in first() and last()

The call to update_tableview() was in the wrong place, resulting in it creating
the table view, but not updating an existing one.
This commit is contained in:
Thomas Goyne 2015-12-01 16:39:23 -08:00 committed by Thomas Goyne
parent f780342851
commit 635bafe90f
1 changed files with 2 additions and 4 deletions

View File

@ -108,9 +108,8 @@ util::Optional<RowExpr> Results::first()
case Mode::Table: case Mode::Table:
return m_table->size() == 0 ? util::none : util::make_optional(m_table->front()); return m_table->size() == 0 ? util::none : util::make_optional(m_table->front());
case Mode::Query: case Mode::Query:
update_tableview();
REALM_FALLTHROUGH;
case Mode::TableView: case Mode::TableView:
update_tableview();
return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.front()); return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.front());
} }
REALM_UNREACHABLE(); REALM_UNREACHABLE();
@ -125,9 +124,8 @@ util::Optional<RowExpr> Results::last()
case Mode::Table: case Mode::Table:
return m_table->size() == 0 ? util::none : util::make_optional(m_table->back()); return m_table->size() == 0 ? util::none : util::make_optional(m_table->back());
case Mode::Query: case Mode::Query:
update_tableview();
REALM_FALLTHROUGH;
case Mode::TableView: case Mode::TableView:
update_tableview();
return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.back()); return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.back());
} }
REALM_UNREACHABLE(); REALM_UNREACHABLE();