Expose the object class name from Results
This commit is contained in:
parent
d1175fe364
commit
d7fe9f9fb8
|
@ -160,7 +160,9 @@ size_t Results::index_of(Row const& row)
|
|||
throw DetatchedAccessorException{};
|
||||
}
|
||||
if (m_table && row.get_table() != m_table) {
|
||||
throw IncorrectTableException{m_table, row.get_table()};
|
||||
throw IncorrectTableException{
|
||||
ObjectStore::object_type_for_table_name(m_table->get_name()),
|
||||
ObjectStore::object_type_for_table_name(row.get_table()->get_name())};
|
||||
}
|
||||
return index_of(row.get_index());
|
||||
}
|
||||
|
@ -310,6 +312,11 @@ TableView Results::get_tableview()
|
|||
REALM_UNREACHABLE();
|
||||
}
|
||||
|
||||
StringData Results::get_object_type() const noexcept
|
||||
{
|
||||
return ObjectStore::object_type_for_table_name(m_table->get_name());
|
||||
}
|
||||
|
||||
Results Results::sort(realm::SortOrder&& sort) const
|
||||
{
|
||||
return Results(m_realm, get_query(), std::move(sort));
|
||||
|
|
|
@ -65,6 +65,9 @@ public:
|
|||
// Get a tableview containing the same rows as this Results
|
||||
TableView get_tableview();
|
||||
|
||||
// Get the object type which will be returned by get()
|
||||
StringData get_object_type() const noexcept;
|
||||
|
||||
// Get the size of this results
|
||||
// Can be either O(1) or O(N) depending on the state of things
|
||||
size_t size();
|
||||
|
@ -128,8 +131,8 @@ public:
|
|||
|
||||
// The input Row object belongs to a different table
|
||||
struct IncorrectTableException {
|
||||
const Table* expected;
|
||||
const Table* actual;
|
||||
StringData expected;
|
||||
StringData actual;
|
||||
};
|
||||
|
||||
// The requested aggregate operation is not supported for the column type
|
||||
|
|
Loading…
Reference in New Issue