Add ObjectStore::is_empty()
This commit is contained in:
parent
271432bd1c
commit
e1e9cd8cd7
|
@ -501,7 +501,19 @@ void ObjectStore::delete_data_for_object(Group *group, const StringData &object_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObjectStore::is_empty(const Group *group) {
|
||||||
|
for (size_t i = 0; i < group->size(); i++) {
|
||||||
|
ConstTableRef table = group->get_table(i);
|
||||||
|
std::string object_type = object_type_for_table_name(table->get_name());
|
||||||
|
if (!object_type.length()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!table->is_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
InvalidSchemaVersionException::InvalidSchemaVersionException(uint64_t old_version, uint64_t new_version) :
|
InvalidSchemaVersionException::InvalidSchemaVersionException(uint64_t old_version, uint64_t new_version) :
|
||||||
m_old_version(old_version), m_new_version(new_version)
|
m_old_version(old_version), m_new_version(new_version)
|
||||||
|
|
|
@ -70,6 +70,9 @@ namespace realm {
|
||||||
// deletes the table for the given type
|
// deletes the table for the given type
|
||||||
static void delete_data_for_object(Group *group, const StringData &object_type);
|
static void delete_data_for_object(Group *group, const StringData &object_type);
|
||||||
|
|
||||||
|
// indicates if this group contains any objects
|
||||||
|
static bool is_empty(const Group *group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// set a new schema version
|
// set a new schema version
|
||||||
static void set_schema_version(Group *group, uint64_t version);
|
static void set_schema_version(Group *group, uint64_t version);
|
||||||
|
|
Loading…
Reference in New Issue