当前位置: 首页>>代码示例>>C++>>正文


C++ TableRef::find_first_string方法代码示例

本文整理汇总了C++中TableRef::find_first_string方法的典型用法代码示例。如果您正苦于以下问题:C++ TableRef::find_first_string方法的具体用法?C++ TableRef::find_first_string怎么用?C++ TableRef::find_first_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TableRef的用法示例。


在下文中一共展示了TableRef::find_first_string方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

SyncFileActionMetadata::SyncFileActionMetadata(const SyncMetadataManager& manager,
                                               Action action,
                                               const std::string& original_name,
                                               const std::string& url,
                                               const std::string& user_identity,
                                               util::Optional<std::string> new_name)
: m_schema(manager.m_file_action_schema)
{
    size_t raw_action = static_cast<size_t>(action);

    // Open the Realm.
    m_realm = Realm::get_shared_realm(manager.get_configuration());

    // Retrieve or create the row for this object.
    TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_fileActionMetadata);
    m_realm->begin_transaction();
    size_t row_idx = table->find_first_string(m_schema.idx_original_name, original_name);
    if (row_idx == not_found) {
        row_idx = table->add_empty_row();
        table->set_string(m_schema.idx_original_name, row_idx, original_name);
    }
    table->set_string(m_schema.idx_new_name, row_idx, new_name);
    table->set_int(m_schema.idx_action, row_idx, raw_action);
    table->set_string(m_schema.idx_url, row_idx, url);
    table->set_string(m_schema.idx_user_identity, row_idx, user_identity);
    m_realm->commit_transaction();
    m_row = table->get(row_idx);
}
开发者ID:FsThatOne,项目名称:VOne,代码行数:28,代码来源:sync_metadata.cpp

示例2: set_primary_key_for_object

void ObjectStore::set_primary_key_for_object(Group& group, StringData object_type, StringData primary_key) {
    TableRef table = group.get_table(c_primaryKeyTableName);

    size_t row = table->find_first_string(c_primaryKeyObjectClassColumnIndex, object_type);

#if REALM_ENABLE_SYNC
    // sync::create_table* functions should have already updated the pk table.
    if (sync::has_object_ids(group)) {
        if (primary_key.size() == 0)
            REALM_ASSERT(row == not_found);
        else {
             REALM_ASSERT(row != not_found);
             REALM_ASSERT(table->get_string(c_primaryKeyPropertyNameColumnIndex, row) == primary_key);
        }
        return;
    }
#endif // REALM_ENABLE_SYNC

    if (row == not_found && primary_key.size()) {
        row = table->add_empty_row();
        table->set_string_unique(c_primaryKeyObjectClassColumnIndex, row, object_type);
        table->set_string(c_primaryKeyPropertyNameColumnIndex, row, primary_key);
        return;
    }
    // set if changing, or remove if setting to nil
    if (primary_key.size() == 0) {
        if (row != not_found) {
            table->move_last_over(row);
        }
    }
    else {
        table->set_string(c_primaryKeyPropertyNameColumnIndex, row, primary_key);
    }
}
开发者ID:FancyPixel,项目名称:gulps,代码行数:34,代码来源:object_store.cpp

示例3: get_primary_key_for_object

StringData ObjectStore::get_primary_key_for_object(Group *group, StringData object_type) {
    TableRef 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);
}
开发者ID:Squidee,项目名称:realm-cocoa,代码行数:11,代码来源:object_store.cpp

示例4: SyncFileActionMetadata

util::Optional<SyncFileActionMetadata> SyncFileActionMetadata::metadata_for_path(const std::string& original_name, const SyncMetadataManager& manager)
{
    auto realm = Realm::get_shared_realm(manager.get_configuration());
    auto schema = manager.m_file_action_schema;
    TableRef table = ObjectStore::table_for_object_type(realm->read_group(), c_sync_fileActionMetadata);
    size_t row_idx = table->find_first_string(schema.idx_original_name, original_name);
    if (row_idx == not_found) {
        return none;
    }
    return SyncFileActionMetadata(std::move(schema), std::move(realm), table->get(row_idx));
}                   
开发者ID:FsThatOne,项目名称:VOne,代码行数:11,代码来源:sync_metadata.cpp

示例5: set_primary_key_for_object

void ObjectStore::set_primary_key_for_object(Group *group, StringData object_type, StringData primary_key) {
    TableRef table = group->get_table(c_primaryKeyTableName);

    // get row or create if new object and populate
    size_t row = table->find_first_string(c_primaryKeyObjectClassColumnIndex, object_type);
    if (row == not_found && primary_key.size()) {
        row = table->add_empty_row();
        table->set_string(c_primaryKeyObjectClassColumnIndex, row, object_type);
    }

    // set if changing, or remove if setting to nil
    if (primary_key.size() == 0) {
        if (row != not_found) {
            table->remove(row);
        }
    }
    else {
        table->set_string(c_primaryKeyPropertyNameColumnIndex, row, primary_key);
    }
}
开发者ID:0atme0,项目名称:tutu1,代码行数:20,代码来源:object_store.cpp


注:本文中的TableRef::find_first_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。