void trans_name2id(ObCellInfo &ci, const ObSchema &schema) { ci.table_id_ = schema.get_table_id(); if (NULL == ci.column_name_.ptr()) { ci.column_id_ = OB_INVALID_ID; } else { ci.column_id_ = schema.find_column_info(ci.column_name_)->get_id(); } }
int64_t MutatorBuilder::query_prefix_meta_(const ObSchema &schema, const bool using_id, const int64_t prefix_start, const char *column_name) { int64_t ret = 0; ObGetParam get_param; ObScanner scanner; ObCellInfo cell_info; if (using_id) { cell_info.table_id_ = schema.get_table_id(); cell_info.column_id_ = schema.find_column_info(column_name)->get_id(); } else { cell_info.table_name_.assign_ptr(const_cast<char*>(schema.get_table_name()), static_cast<int32_t>(strlen(schema.get_table_name()))); cell_info.column_name_.assign_ptr(const_cast<char*>(column_name), static_cast<int32_t>(strlen(column_name))); } char rowkey_info_buffer[1024]; sprintf(rowkey_info_buffer, "%s%020ld", ROWKEY_INFO_ROWKEY, prefix_start); cell_info.row_key_.assign_ptr(rowkey_info_buffer, static_cast<int32_t>(strlen(rowkey_info_buffer))); get_param.add_cell(cell_info); ObVersionRange version_range; version_range.start_version_ = table_start_version_; version_range.border_flag_.set_max_value(); version_range.border_flag_.set_inclusive_start(); get_param.set_version_range(version_range); if (OB_SUCCESS == (ret = client_.get(get_param, scanner))) { CellinfoBuilder::result_set_t result_set; ::MemTank mem_tank; while (OB_SUCCESS == scanner.next_cell()) { ObCellInfo *ci = NULL; if (OB_SUCCESS != scanner.get_cell(&ci)) { break; } if (!using_id) { ::trans_name2id(*ci, schema); } ObCellInfo *new_ci = copy_cell(mem_tank, ci); CellinfoBuilder::merge_obj(new_ci, result_set); } if (0 != result_set.size()) { ObCellInfo *ret_ci = NULL; result_set.get(schema.find_column_info(column_name)->get_id(), ret_ci); if (NULL != ret_ci) { ret_ci->value_.get_int(ret); } } } else { abort(); } return ret; }