本文整理汇总了C++中ConstTableRef类的典型用法代码示例。如果您正苦于以下问题:C++ ConstTableRef类的具体用法?C++ ConstTableRef怎么用?C++ ConstTableRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstTableRef类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_schema_version
uint64_t ObjectStore::get_schema_version(const Group *group) {
ConstTableRef table = group->get_table(c_metadataTableName);
if (!table || table->get_column_count() == 0) {
return ObjectStore::NotVersioned;
}
return table->get_int(c_versionColumnIndex, c_zeroRowIndex);
}
示例2: get_primary_key_for_object
StringData ObjectStore::get_primary_key_for_object(const Group *group, StringData object_type) {
ConstTableRef table = group->get_table(c_primaryKeyTableName);
if (!table) {
return "";
}
size_t row = table->find_first_string(c_primaryKeyObjectClassColumnIndex, object_type);
if (row == not_found) {
return "";
}
return table->get_string(c_primaryKeyPropertyNameColumnIndex, row);
}
示例3: is_empty
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;
}
示例4: table_for_object_type
void ObjectStore::validate_primary_column_uniqueness(const Group *group, Schema const& schema) {
for (auto& object_schema : schema) {
auto primary_prop = object_schema.primary_key_property();
if (!primary_prop) {
continue;
}
ConstTableRef table = table_for_object_type(group, object_schema.name);
if (table->get_distinct_view(primary_prop->table_column).size() != table->size()) {
throw DuplicatePrimaryKeyValueException(object_schema.name, *primary_prop);
}
}
}
示例5:
util::Optional<Property> ObjectStore::property_for_column_index(ConstTableRef& table, size_t column_index)
{
StringData column_name = table->get_column_name(column_index);
#if REALM_ENABLE_SYNC
// The object ID column is an implementation detail, and is omitted from the schema.
// FIXME: Consider filtering out all column names starting with `!`.
if (column_name == sync::object_id_column_name)
return util::none;
#endif
if (table->get_column_type(column_index) == type_Table) {
auto subdesc = table->get_subdescriptor(column_index);
if (subdesc->get_column_count() != 1 || subdesc->get_column_name(0) != ObjectStore::ArrayColumnName)
return util::none;
}
Property property;
property.name = column_name;
property.type = ObjectSchema::from_core_type(*table->get_descriptor(), column_index);
property.is_indexed = table->has_search_index(column_index);
property.table_column = column_index;
if (property.type == PropertyType::Object) {
// set link type for objects and arrays
ConstTableRef linkTable = table->get_link_target(column_index);
property.object_type = ObjectStore::object_type_for_table_name(linkTable->get_name().data());
}
return property;
}
示例6: name
ObjectSchema::ObjectSchema(Group const& group, StringData name, size_t index) : name(name) {
ConstTableRef table;
if (index < group.size()) {
table = group.get_table(index);
}
else {
table = ObjectStore::table_for_object_type(group, name);
}
size_t count = table->get_column_count();
persisted_properties.reserve(count);
for (size_t col = 0; col < count; col++) {
if (auto property = ObjectStore::property_for_column_index(table, col)) {
persisted_properties.push_back(std::move(property.value()));
}
}
primary_key = realm::ObjectStore::get_primary_key_for_object(group, name);
set_primary_key_property();
}
示例7: name
ObjectSchema::ObjectSchema(const Group *group, const std::string &name) : name(name) {
ConstTableRef table = ObjectStore::table_for_object_type(group, name);
size_t count = table->get_column_count();
properties.reserve(count);
for (size_t col = 0; col < count; col++) {
Property property;
property.name = table->get_column_name(col).data();
property.type = (PropertyType)table->get_column_type(col);
property.is_indexed = table->has_search_index(col);
property.is_primary = false;
property.is_nullable = table->is_nullable(col) || property.type == PropertyType::Object;
property.table_column = col;
if (property.type == PropertyType::Object || property.type == PropertyType::Array) {
// set link type for objects and arrays
ConstTableRef linkTable = table->get_link_target(col);
property.object_type = ObjectStore::object_type_for_table_name(linkTable->get_name().data());
}
properties.push_back(std::move(property));
}
primary_key = realm::ObjectStore::get_primary_key_for_object(group, name);
set_primary_key_property();
}
示例8: operator
int64_t operator()(ConstTableRef v) const
{
return v->size();
}