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


C++ ObScanParam类代码示例

本文整理汇总了C++中ObScanParam的典型用法代码示例。如果您正苦于以下问题:C++ ObScanParam类的具体用法?C++ ObScanParam怎么用?C++ ObScanParam使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init_scan_param

int TaskFactory::init_scan_param(const char *table_name, const uint64_t table_id, uint64_t & max_len, ObScanParam & param)
{
  // init version range
  ObVersionRange version_range;
  //version_range.start_version_ = 0;
  version_range.border_flag_.set_min_value();
  version_range.end_version_ = memtable_version_;
  version_range.border_flag_.set_inclusive_end();
  //version_range.border_flag_.set_max_value();
  param.set_version_range(version_range);
  param.set_is_read_consistency(false);
  param.set_is_result_cached(false);
  param.set_is_read_consistency(false);
  int ret = get_max_len(table_id, max_len);
  if (ret != OB_SUCCESS)
  {
    TBSYS_LOG(ERROR, "get table max rowkey len failed:table[%lu], ret[%d]", table_id, ret);
  }
  else
  {
//    ret = add_all_columns(table_id, param);
    ret = add_columns(table_name, table_id, param);
    if (ret != OB_SUCCESS)
    {
      TBSYS_LOG(ERROR, "add all columns failed:table[%lu], ret[%d]", table_id, ret);
    }
  }
  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:29,代码来源:task_factory.cpp

示例2: TBSYS_LOG

 void ObScanParamLoader::dump_param(ObScanParam &param)
 {
   TBSYS_LOG(INFO, "DUMP ObScanParam:");
   TBSYS_LOG(INFO, "table_name:[%.*s]", param.get_table_name().length(), param.get_table_name().ptr());
   TBSYS_LOG(INFO, "range:");
   param.get_range()->dump();
 }
开发者ID:Abioy,项目名称:oceanbase,代码行数:7,代码来源:ob_scan_param_loader.cpp

示例3: printf

int MockClientProxy::scan(const ObScanParam& scan_param,ObScanner& scanner)
{
  printf("%.*s\n", scan_param.get_range()->start_key_.length(), 
    scan_param.get_range()->start_key_.ptr());
  gen_scanner(scanner);
  this->scan_param_ = const_cast<ObScanParam*>(&scan_param);
  return OB_SUCCESS;
}
开发者ID:Abioy,项目名称:oceanbase,代码行数:8,代码来源:test_nb_accessor.cpp

示例4: while

void TaskManager::setup_all_tasks_vesion(int64_t version)
{
  map<uint64_t, TaskInfo>::iterator it = wait_queue_.begin();
  while (it != wait_queue_.end())
  {
    ObScanParam *param = const_cast<ObScanParam *>(&it->second.get_param());
    ObVersionRange version_range;
    version_range.border_flag_.set_min_value();
    version_range.end_version_ = version;
    version_range.border_flag_.set_inclusive_end();
    param->set_version_range(version_range);
    it++;
  }
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:14,代码来源:task_manager.cpp

示例5: get_next_scan_param

int ObUpsScan::get_next_scan_param(const ObRowkey &last_rowkey, ObScanParam &scan_param)
{
  int ret = OB_SUCCESS;

  ObNewRange next_range = *(scan_param.get_range());

  next_range.start_key_ = last_rowkey;
  next_range.border_flag_.unset_inclusive_start();

  if(OB_SUCCESS != (ret = scan_param.set_range(next_range)))
  {
    TBSYS_LOG(WARN, "scan param set range fail:ret[%d]", ret);
  }

  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:16,代码来源:ob_ups_scan.cpp

示例6: col_schema

int ObMetaTable3::MyIterator::add_scan_columns(ObScanParam &scan_param)
{
  int ret = OB_SUCCESS;
  if (OB_SUCCESS != (ret = get_table_schema()))
  {
    TBSYS_LOG(WARN, "failed to get table schema, err=%d", ret);
  }
  else
  {
    ObMetaTableColumnSchema col_schema(table_schema_);
    for (int64_t i = 0; i < col_schema.get_columns_num(); ++i)
    {
      uint64_t cid = col_schema.get_cid_by_idx(i);
      if (OB_INVALID_ID == cid)
      {
        TBSYS_LOG(ERROR, "failed to get column id, i=%ld", i);
      }
      else if (OB_SUCCESS != (ret = scan_param.add_column(cid)))
      {
        TBSYS_LOG(WARN, "failed to add column, err=%d", ret);
        break;
      }
    }
  }
  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:26,代码来源:ob_meta_table3.cpp

示例7:

int ObFakeSqlUpsRpcProxy2::gen_new_scanner(const ObScanParam & scan_param, ObNewScanner & new_scanner)
{
    int ret = OB_SUCCESS;
    const ObNewRange *const range = scan_param.get_range();
    int start = get_int(range->start_key_);
    int end = get_int(range->end_key_);

    new_scanner.clear();

    ObBorderFlag border_flag;
    border_flag = range->border_flag_;

    if (start+100 >= end)
    {
        if(OB_SUCCESS != (ret = gen_new_scanner(range->table_id_, start, end, border_flag, new_scanner, true)))
        {
            TBSYS_LOG(WARN, "gen new scanner fail:ret[%d]", ret);
        }
    }
    else
    {
        border_flag.set_inclusive_end();
        if(OB_SUCCESS != (ret = gen_new_scanner(range->table_id_, start, start+100, border_flag, new_scanner, false)))
        {
            TBSYS_LOG(WARN, "gen new scanner fail:ret[%d]", ret);
        }
    }
    return ret;
}
开发者ID:cuiwm,项目名称:oceanbase,代码行数:29,代码来源:ob_fake_sql_ups_rpc_proxy2.cpp

示例8: scan

int ObRootServerRpcStub::scan(const ObServer & server, const int64_t timeout, 
                             const ObScanParam & param, ObScanner & result)
{
  ObDataBuffer data_buff;
  int ret = get_frame_buffer(data_buff);
  if (ret != OB_SUCCESS)
  {
    TBSYS_LOG(ERROR, "check get rpc buffer failed:ret[%d]", ret);
  }
  else
  {
    // step 1. serialize ObGetParam to the data_buff
    ret = param.serialize(data_buff.get_data(), data_buff.get_capacity(), 
        data_buff.get_position());
    if (OB_SUCCESS != ret)
    {
      TBSYS_LOG(ERROR, "serialize get param failed:ret[%d]", ret);
    }
  }

  // step 2. send request for get data 
  if (OB_SUCCESS == ret)
  {
    ret = rpc_frame_->send_request(server, OB_SCAN_REQUEST, DEFAULT_VERSION, 
        timeout, data_buff);
    if (ret != OB_SUCCESS)
    {
      TBSYS_LOG(WARN, "get data failed from server:ret[%d]", ret);
    }
  }
  
  // step 3. deserialize the response result
  int64_t pos = 0;
  if (OB_SUCCESS == ret)
  {
    ObResultCode result_code;
    ret = result_code.deserialize(data_buff.get_data(), data_buff.get_position(), pos);
    if (OB_SUCCESS != ret)
    {
      TBSYS_LOG(ERROR, "deserialize result failed:pos[%ld], ret[%d]", pos, ret);
    }
    else if ((ret = result_code.result_code_) != OB_SUCCESS)
    {
      TBSYS_LOG(ERROR,"scan failed,ret[%d]",ret);
    }
  }
  
  // step 4. deserialize the scanner 
  if (OB_SUCCESS == ret)
  {
    result.clear();
    ret = result.deserialize(data_buff.get_data(), data_buff.get_position(), pos);
    if (OB_SUCCESS != ret)
    {
      TBSYS_LOG(ERROR, "deserialize scanner from buff failed:pos[%ld], ret[%d]", pos, ret);
    }
  }
  return ret;
}
开发者ID:CCoder123,项目名称:pproj,代码行数:59,代码来源:ob_root_server_rpc.cpp

示例9: build_total_scan_param

int MutatorBuilder::build_total_scan_param(ObScanParam &scan_param, PageArena<char> &allocer,
                                          const int64_t table_start_version,
                                          const bool using_id, const int64_t table_pos)
{
  int ret = OB_SUCCESS;
  const ObSchema &schema = schema_mgr_.begin()[table_pos];

  int64_t cur_rowkey_info = get_cur_rowkey_info_(schema, using_id, rb_array_[table_pos]->get_prefix_start());
  std::pair<ObString,ObString> key_range = rb_array_[table_pos]->get_rowkey4total_scan(cur_rowkey_info, allocer);
  ObRange range;
  range.start_key_ = key_range.first;
  range.end_key_ = key_range.second;

  const ObColumnSchema *iter = NULL;
  for (iter = schema.column_begin(); iter != schema.column_end(); iter++)
  {
    if (using_id)
    {
      scan_param.add_column(iter->get_id());
    }
    else
    {
      ObString column_name;
      column_name.assign_ptr(const_cast<char*>(iter->get_name()), static_cast<int32_t>(strlen(iter->get_name())));
      scan_param.add_column(column_name);
    }
  }

  if (using_id)
  {
    scan_param.set(schema.get_table_id(), ObString(), range);
  }
  else
  {
    ObString table_name;
    table_name.assign_ptr(const_cast<char*>(schema.get_table_name()), static_cast<int32_t>(strlen(schema.get_table_name())));
    scan_param.set(OB_INVALID_ID, table_name, range);
  }

  ObVersionRange version_range;
  version_range.start_version_ = table_start_version;
  version_range.border_flag_.set_max_value();
  version_range.border_flag_.set_inclusive_start();
  scan_param.set_version_range(version_range);
  return ret;
}
开发者ID:Abioy,项目名称:oceanbase,代码行数:46,代码来源:mutator_builder.cpp

示例10: is_finish_scan

 bool is_finish_scan(const ObScanParam & param, const ObNewRange & result_range)
 {
   bool ret = false;
   if (ScanFlag::FORWARD == param.get_scan_direction())
   {
     if (result_range.compare_with_endkey2(*param.get_range()) >= 0)
     {
       ret = true;
     }
   }
   else
   {
     if (result_range.compare_with_startkey2(*param.get_range()) <= 0)
     {
       ret = true;
     }
   }
   return ret;
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:19,代码来源:ob_read_param_modifier.cpp

示例11: prepare_scan_param

void prepare_scan_param(ObScanParam &scan_param, const ObSchema &schema,
                        const int64_t table_start_version, const bool using_id)
{
  ObRange range;
  range.border_flag_.set_min_value();
  range.border_flag_.set_max_value();

  const ObColumnSchema *iter = NULL;
  for (iter = schema.column_begin(); iter != schema.column_end(); iter++)
  {
    if (using_id)
    {
      scan_param.add_column(iter->get_id());
    }
    else
    {
      ObString column_name;
      column_name.assign_ptr(const_cast<char*>(iter->get_name()), strlen(iter->get_name()));
      scan_param.add_column(column_name);
    }
  }

  if (using_id)
  {
    scan_param.set(schema.get_table_id(), ObString(), range);
  }
  else
  {
    ObString table_name;
    table_name.assign(const_cast<char*>(schema.get_table_name()), strlen(schema.get_table_name()));
    scan_param.set(OB_INVALID_ID, table_name, range);
  }

  ObVersionRange version_range;
  version_range.start_version_ = table_start_version;
  version_range.border_flag_.set_max_value();
  version_range.border_flag_.set_inclusive_start();
  scan_param.set_version_range(version_range);
}
开发者ID:CCoder123,项目名称:pproj,代码行数:39,代码来源:total_scan.cpp

示例12: scan

int ObMSScanCellStream::scan(const ObScanParam & param, const ObMergerTabletLocation & cs_addr)
{
  int ret = OB_SUCCESS;
  const ObRange * range = param.get_range();
  if (NULL == range)
  {
    TBSYS_LOG(ERROR, "%s", "check scan param failed");
    ret = OB_INPUT_PARAM_ERROR;
  }
  else
  {
    cs_addr_ = cs_addr;
    reset_inner_stat();
    scan_param_ = &param;
  }
  return ret;
}
开发者ID:CCoder123,项目名称:pproj,代码行数:17,代码来源:ob_ms_scan_cell_stream.cpp

示例13: add_all_columns

int TaskFactory::add_all_columns(const uint64_t table_id, ObScanParam & param)
{
  int ret = OB_SUCCESS;
  int32_t count = 0;
  const ObColumnSchemaV2 * column_schema = schema_->get_table_schema(table_id, count);
  if ((NULL == column_schema) || (0 == count))
  {
    ret = OB_ERROR;
    TBSYS_LOG(ERROR, "check column schema or schema count failed:column[%p], count[%d]",
        column_schema, count);
  }
  else
  {
    ObString column;
    const char * column_name = NULL;
    for (int32_t i = 0; i < count; ++i)
    {
      column_name = column_schema->get_name();
      if (column_name != NULL)
      {
        TBSYS_LOG(DEBUG, "TableId:%ld, COLUMN=%s", table_id, column_name);

        column.assign(const_cast<char *>(column_name), (int32_t)strlen(column_name));
        ret = param.add_column(column);
        if (ret != OB_SUCCESS)
        {
          TBSYS_LOG(ERROR, "add column failed:table[%lu], column[%s], ret[%d]",
              table_id, column_name, ret);
          ret = OB_ERROR;
          break;
        }
      }
      else
      {
        ret = OB_ERROR;
        TBSYS_LOG(ERROR, "check column name failed:table[%lu], name[%s]", table_id, column_name);
        break;
      }
      ++column_schema;
    }
  }
  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:43,代码来源:task_factory.cpp

示例14: decoded_scan_param

 int ObScanParamLoader::decoded_scan_param(ObScanParam &org_param, ObScanParam &decoded_param)
 {
   int ret = OB_SUCCESS;
   ObSchemaManagerV2 schema_mgr;
   tbsys::CConfig config;
   /* read from Schema file */
   if (!schema_mgr.parse_from_file(OBSP_SCHEMA_FILE_NAME, config))
   {
     TBSYS_LOG(ERROR, "fail to load schema file [test_schema.ini]");        
     ret = OB_ERROR;
   }
   /* decode the SQL to scan param */
   if (OB_SUCCESS == ret)
   {
     dump_param(org_param);
     decoded_param.reset();
     ret = ob_decode_scan_param(org_param, schema_mgr, decoded_param);
   }
   return ret;
 }
开发者ID:Abioy,项目名称:oceanbase,代码行数:20,代码来源:ob_scan_param_loader.cpp

示例15: scan

 int ObScanCellStream::scan(const ObScanParam & param)
 {
   int ret = OB_SUCCESS;
   const ObRange * range = param.get_range();
   if (NULL == range)
   {
     TBSYS_LOG(WARN, "check scan param failed");
     ret = OB_INPUT_PARAM_ERROR;
   }
   else
   {
     reset_inner_stat();
     scan_param_ = &param;
     ret = scan_row_data();
     if (ret != OB_SUCCESS)
     {
       TBSYS_LOG(WARN, "scan server data failed:ret[%d]", ret);
     }
     else 
     {
       /**
        * ups return empty scanner, just return OB_ITER_END
        */
       if (cur_result_.is_empty() && !ObCellStream::first_rpc_)
       {
         // check already finish scan
         ret = check_finish_scan(cur_scan_param_);
         if (OB_SUCCESS != ret)
         {
           TBSYS_LOG(WARN, "check finish scan failed:ret[%d]", ret);
         }
         else if (finish_)
         {
           ret = OB_ITER_END;
         }
       }
     }
   }
   return ret;
 }
开发者ID:Abioy,项目名称:oceanbase,代码行数:40,代码来源:ob_scan_cell_stream.cpp


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