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


C++ ObScanner::set_is_req_fullfilled方法代码示例

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


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

示例1: handle_get_table

int MockChunkServer::handle_get_table(ObPacket * ob_packet)
{
  int ret = OB_SUCCESS;
  ObDataBuffer* data = ob_packet->get_buffer();
  if (NULL == data)
  {
    ret = OB_ERROR;
  }

  ObGetParam param;
  if (OB_SUCCESS == ret)
  {
    ret = param.deserialize(data->get_data(), data->get_capacity(), data->get_position());
    if (ret != OB_SUCCESS)
    {
      TBSYS_LOG(ERROR, "%s", "check param failed");
    }
  }

  tbnet::Connection* connection = ob_packet->get_connection();
  ThreadSpecificBuffer::Buffer* thread_buffer = response_packet_buffer_.get_buffer();
  if (NULL == thread_buffer)
  {
    ret = OB_ERROR;
  }
  else
  {
    thread_buffer->reset();
    ObDataBuffer out_buffer(thread_buffer->current(), thread_buffer->remain());

    ObResultCode result_msg;
    result_msg.result_code_ = ret;
    ret = result_msg.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());

    // fake data cell
    ObCellInfo cell;
    ObScanner scanner;
    ObRowkey row_key;
    ObString column_name;
    char temp[256] = "";
    cell.table_id_ = 101; 
    for (uint64_t i = 0; i < 10; ++i)
    {
      snprintf(temp, 256, "chunk_%lu_get_row_key:%lu", i, i);
      row_key = make_rowkey(temp, &allocator_);
      cell.row_key_ = row_key;
      cell.column_id_ = i + 1;
      cell.value_.set_int(2234 + i);
      scanner.add_cell(cell);
    }
    scanner.set_is_req_fullfilled(true, 1);
    int32_t channel_id = ob_packet->getChannelId();
    ret = scanner.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());
    //
    ret = send_response(OB_GET_RESPONSE, 1, out_buffer, connection, channel_id);
  }
  TBSYS_LOG(INFO, "handle get table result:ret[%d]", ret);
  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:59,代码来源:mock_chunk_server.cpp

示例2: fill_result


//.........这里部分代码省略.........
  }

  for (int64_t i = 0; (i < cur_row_cell_cnt_) && (OB_SUCCESS == err); i ++, poped_cell_count_ ++)
  {
    if ((OB_SUCCESS != (err = scanner.add_cell(row_cells_[i]))))
    {
      TBSYS_LOG(WARN,"fail to add cell to scanner [err:%d]", err);
    }
  }
  while ((OB_SUCCESS == err) && (!size_over_flow))
  {
    if ((OB_SUCCESS != (err = merger_operator_.next_cell())) && (OB_ITER_END != err))
    {
      TBSYS_LOG(WARN,"fail to call next_cell [err:%d]", err);
    }
    if ((OB_SUCCESS == err) && (OB_SUCCESS != (err = merger_operator_.get_cell(&cur_cell, &row_changed))))
    {
      TBSYS_LOG(WARN,"fail to get cell from ObGetMerger [err:%d]", err);
    }
    if (OB_SUCCESS == err)
    {
      got_cell_count ++;
    }
    if ((OB_SUCCESS == err) && row_changed)
    {
      cur_row_cell_cnt_ = 0;
      last_not_exist_cell_.table_id_ = OB_INVALID_ID;
    }
    if ((OB_SUCCESS == err)
      && ((cur_cell->value_.get_ext() == ObActionFlag::OP_ROW_DOES_NOT_EXIST)
      || (cur_cell->value_.get_ext() == ObActionFlag::OP_DEL_TABLE)))
    {
      if ((OB_INVALID_ID != last_not_exist_cell_.table_id_) && (last_not_exist_cell_.table_id_ == cur_cell->table_id_)
        && (last_not_exist_cell_.row_key_ == cur_cell->row_key_))
      {
        poped_cell_count_ ++;
        continue ;
      }
      else
      {
        last_not_exist_cell_ = *cur_cell;
      }
    }

    if ((OB_SUCCESS == err) && (cur_row_cell_cnt_ >= MAX_ROW_COLUMN_COUNT))
    {
      TBSYS_LOG(WARN,"row cell count is too large [cur_row_cell_cnt_:%ld, MAX_ROW_COLUMN_COUNT:%ld]",
        cur_row_cell_cnt_, MAX_ROW_COLUMN_COUNT);
      //err = OB_ARRAY_OUT_OF_RANGE;
      cur_row_cell_cnt_ = 0;
    }
    if (OB_SUCCESS == err)
    {
      row_cells_[cur_row_cell_cnt_].table_id_ = OB_INVALID_ID;
      row_cells_[cur_row_cell_cnt_].table_name_ = org_param[poped_cell_count_]->table_name_;
      row_cells_[cur_row_cell_cnt_].column_name_ = org_param[poped_cell_count_]->column_name_;
      row_cells_[cur_row_cell_cnt_].column_id_ = OB_INVALID_ID;
      row_cells_[cur_row_cell_cnt_].row_key_ = cur_cell->row_key_;
      row_cells_[cur_row_cell_cnt_].value_ = cur_cell->value_;
      ++cur_row_cell_cnt_;
    }
    if (OB_SUCCESS == err)
    {
      if ((OB_SUCCESS != (err = scanner.add_cell(row_cells_[cur_row_cell_cnt_ - 1]))) && (OB_SIZE_OVERFLOW != err))
      {
        TBSYS_LOG(WARN,"fail to add cell to result [err:%d]", err);
      }
      else if (OB_SIZE_OVERFLOW == err)
      {
        if (OB_SUCCESS != (err = scanner.rollback()))
        {
          TBSYS_LOG(WARN,"fail to rollback ObScanner [err:%d]", err);
        }
        else
        {
          size_over_flow = true;
          poped_cell_count_ -= cur_row_cell_cnt_ - 1;
          got_cell_count -= cur_row_cell_cnt_;
        }
      }
      else if (OB_SUCCESS == err)
      {
        poped_cell_count_ ++;
      }
    }
  }
  if (OB_ITER_END == err)
  {
    err = OB_SUCCESS;
  }
  if (OB_SUCCESS == err)
  {
    got_all_result = !size_over_flow;
  }
  if ((OB_SUCCESS == err) && (OB_SUCCESS != (err = scanner.set_is_req_fullfilled(got_all_result,got_cell_count))))
  {
    TBSYS_LOG(WARN,"fail to set fullfill infomation [err:%d]", err);
  }
  return err;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:101,代码来源:ob_ms_get_request.cpp

示例3: fopen

TEST(TestObScanner, add_cell)
{
  ObScanner fem;
  fem.set_is_req_fullfilled(true, 1011);
  fem.set_data_version(170);

  char buf[BUFSIZ];
  int64_t pospos = 0;
  fem.serialize(buf, BUFSIZ, pospos);

  FILE *fd;
  fd = fopen("tmptest", "w+");
  fwrite(buf, 1, pospos, fd);
  fclose(fd);

  ObScanner os;
  ObScanner ost;
  /*** added by wushi ***/
  int64_t fullfilled_item = 0;
  int64_t tmp = 0;
  bool is_fullfilled = true;
  bool tmp_bool = false;
  /// initialize
  ASSERT_EQ(os.get_is_req_fullfilled(tmp_bool, fullfilled_item),0);
  EXPECT_FALSE(tmp_bool);
  ASSERT_EQ(fullfilled_item,0);
  /// set fullfilled
  is_fullfilled = true;
  fullfilled_item = 1000;
  os.set_is_req_fullfilled(is_fullfilled,fullfilled_item);
  ASSERT_EQ(os.get_is_req_fullfilled(tmp_bool, tmp),0);
  ASSERT_EQ(tmp_bool,is_fullfilled);
  ASSERT_EQ(tmp,fullfilled_item);

  /*** added by wushi ***/

  ObCellInfo oci;

  oci.table_name_.assign((char*)"table1", 6);
  oci.row_key_.assign((char*)"row1", 4);
  oci.column_name_.assign((char*)"column1", 7);
  oci.value_.set_int(0xff);

  ost.set_mem_size_limit(20);
  ASSERT_EQ(OB_SIZE_OVERFLOW, ost.add_cell(oci));
  os.set_mem_size_limit(1024 * 1024 * 2);
  ASSERT_EQ(OB_SUCCESS, os.add_cell(oci));

  oci.column_name_.assign((char*)"column2", 7);
  oci.value_.set_int(0xfe);
  ASSERT_EQ(OB_SUCCESS, os.add_cell(oci));

  ObScannerIterator iter = os.begin();
  ObCellInfo tci;
  ASSERT_EQ(OB_SUCCESS, iter.get_cell(tci));

  ASSERT_EQ(string("table1"), string(tci.table_name_.ptr(), tci.table_name_.length()));
  ASSERT_EQ(string("row1"), string(tci.row_key_.ptr(), tci.row_key_.length()));
  ASSERT_EQ(string("column1"), string(tci.column_name_.ptr(), tci.column_name_.length()));
  ASSERT_EQ(OB_SUCCESS, tci.value_.get_int(tmp));
  ASSERT_EQ(0xff, tmp);

  iter++;
  ASSERT_EQ(OB_SUCCESS, iter.get_cell(tci));

  ASSERT_EQ(string("table1"), string(tci.table_name_.ptr(), tci.table_name_.length()));
  ASSERT_EQ(string("row1"), string(tci.row_key_.ptr(), tci.row_key_.length()));
  ASSERT_EQ(string("column2"), string(tci.column_name_.ptr(), tci.column_name_.length()));
  ASSERT_EQ(OB_SUCCESS, tci.value_.get_int(tmp));
  ASSERT_EQ(0xfe, tmp);

  iter++;

  ASSERT_EQ(true, os.end() == iter);

  //ObCellInfo oci;
  char row_key_buffer[1024];

  oci.table_name_.assign((char*)"table1", 6);
  sprintf(row_key_buffer, "row1");
  oci.row_key_.assign(row_key_buffer, 4);
  oci.column_name_.assign((char*)"column1", 7);
  oci.value_.set_int(0xff);

  ASSERT_EQ(OB_SUCCESS, os.add_cell(oci));

  oci.table_name_.assign((char*)"table1", 6);
  sprintf(row_key_buffer, "row1");
  oci.row_key_.assign(row_key_buffer, 4);
  oci.column_name_.assign((char*)"column2", 7);
  oci.value_.set_int(0xee);

  os.set_mem_size_limit(20);
  ASSERT_EQ(OB_SIZE_OVERFLOW, os.add_cell(oci));
  os.set_mem_size_limit(1024 * 1024 * 2);
  ASSERT_EQ(OB_SUCCESS, os.add_cell(oci));

  oci.table_name_.assign((char*)"table1", 6);
  sprintf(row_key_buffer, "row2");
  oci.row_key_.assign(row_key_buffer, 4);
//.........这里部分代码省略.........
开发者ID:Abioy,项目名称:oceanbase,代码行数:101,代码来源:test_ob_scanner.cpp

示例4: handle_mock_scan


//.........这里部分代码省略.........
        {
          row_key.assign((char*)mock::join_rowkey,strlen(mock::join_rowkey));
          cell.column_id_ = mock::join_column2_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::join_column2_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::join_column2_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
        }
        else
        {
          TBSYS_LOG(ERROR, "unepxected column id [tableid:%lu,columnid:%lu]", cell.table_id_,
                    scan_param.get_column_id()[i]);
          ret = OB_ERR_UNEXPECTED;
        }
      }
    }
    else if (mock::table_id == cell.table_id_)
    {
      for (int32_t i = 0; i < scan_param.get_column_id_size(); i++)
      {
        if (mock::column1_id == scan_param.get_column_id()[i])
        {
          row_key.assign((char*)mock::rowkey,strlen(mock::rowkey));
          cell.column_id_ = mock::column1_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::column1_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::column1_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
        }
        else if (mock::column2_id == scan_param.get_column_id()[i])
        {
          row_key.assign((char*)mock::rowkey,strlen(mock::rowkey));
          cell.column_id_ = mock::column2_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::column2_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::column2_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
        }
        else
        {
          TBSYS_LOG(ERROR, "unepxected column id [tableid:%lu,columnid:%lu]", cell.table_id_,
                    scan_param.get_column_id()[i]);
          ret = OB_ERR_UNEXPECTED;
        }
      }
    }
    else
    {
      TBSYS_LOG(ERROR, "unexpected table id [tableid:%lu]", cell.table_id_);
      ret = OB_ERR_UNEXPECTED;
    }

    if (OB_SUCCESS == ret)
    {
      ret = scanner.set_is_req_fullfilled(true,1);
      // scanner.set_timestamp(mock::schema_timestamp);
    }
    int64_t pos = 0;
    char range_buf[512];
    ObString range_str;
    if (OB_SUCCESS == ret)
    {
      ObRange range;
      range.border_flag_.set_min_value();
      range.border_flag_.set_max_value();
      ret = range.serialize(range_buf,sizeof(range_buf),pos);
      if (OB_SUCCESS == ret)
      {
        range_str.assign(range_buf,pos);
        // ret = scanner.set_ext_info(range_str);
      }
      pos = 0;
      TBSYS_LOG(INFO, "pos:%ld,ret:%d",pos, 
                range.deserialize(range_str.ptr(),range_str.length(),pos));
    }
    int32_t channel_id = ob_packet->getChannelId();
    if (OB_SUCCESS == ret)
    {
      ret = scanner.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());
    }
    if (OB_SUCCESS == ret)
    {
      ret = send_response(OB_GET_RESPONSE, 1, out_buffer, connection, channel_id);
    }
  }
  TBSYS_LOG(INFO, "handle scan root table result:ret[%d]", ret);
  return ret;
}
开发者ID:CCoder123,项目名称:pproj,代码行数:101,代码来源:mock_update_server2.cpp

示例5: handle_mock_get


//.........这里部分代码省略.........
          }
        }
        else if (0 == cell.column_id_)
        {
          row_key.assign((char*)mock::join_rowkey,strlen(mock::join_rowkey));
          cell.column_id_ = mock::join_column1_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::join_column1_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::join_column1_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
          if (OB_SUCCESS == ret)
          {
            row_key.assign((char*)mock::join_rowkey,strlen(mock::join_rowkey));
            cell.column_id_ = mock::join_column2_id;
            cell.row_key_ = row_key;
            cell.value_.set_int(mock::join_column2_ups_value_1,true);
            ret = scanner.add_cell(cell);
            if (OB_SUCCESS == ret)
            {
              cell.value_.set_int(mock::join_column2_ups_value_2,true);
              ret = scanner.add_cell(cell);
            }
          }
          cell.column_id_ = 0;
        }
        else
        {
          TBSYS_LOG(ERROR, "unepxected column id [tableid:%lu,columnid:%lu]", cell.table_id_,
                    cell.column_id_);
          ret = OB_ERR_UNEXPECTED;
        }
      }
      else if (mock::table_id == cell.table_id_)
      {
        if (mock::column1_id == cell.column_id_)
        {
          row_key.assign((char*)mock::rowkey,strlen(mock::rowkey));
          cell.column_id_ = mock::column1_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::column1_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::column1_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
        }
        else if (mock::column2_id == cell.column_id_)
        {
          row_key.assign((char*)mock::rowkey,strlen(mock::rowkey));
          cell.column_id_ = mock::column2_id;
          cell.row_key_ = row_key;
          cell.value_.set_int(mock::column2_ups_value_1,true);
          ret = scanner.add_cell(cell);
          if (OB_SUCCESS == ret)
          {
            cell.value_.set_int(mock::column2_ups_value_2,true);
            ret = scanner.add_cell(cell);
          }
        }
        else
        {
          TBSYS_LOG(ERROR, "unepxected column id [tableid:%lu,columnid:%lu]", cell.table_id_,
                    cell.column_id_);
          ret = OB_ERR_UNEXPECTED;
        }
      }
      else
      {
        TBSYS_LOG(ERROR, "unexpected table id [tableid:%lu]", cell.table_id_);
        ret = OB_ERR_UNEXPECTED;
      }
    }


    if (OB_SUCCESS == ret)
    {
      int64_t fullfilled_item_num = 0;
      if(0 == cell.column_id_)
      {
        fullfilled_item_num = 1;
      }
      else
      {
        fullfilled_item_num = 2;
      }
      ret = scanner.set_is_req_fullfilled(true,fullfilled_item_num);
      //scanner.set_timestamp(mock::schema_timestamp);
    }
    int32_t channel_id = ob_packet->getChannelId();
    ret = scanner.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());
    ret = send_response(OB_GET_RESPONSE, 1, out_buffer, connection, channel_id);
  }
  TBSYS_LOG(INFO, "handle scan root table result:ret[%d]", ret);
  return ret;
}
开发者ID:CCoder123,项目名称:pproj,代码行数:101,代码来源:mock_update_server2.cpp

示例6: handle_scan_table

int MockChunkServer::handle_scan_table(ObPacket * ob_packet)
{
  int ret = OB_SUCCESS;
  ObDataBuffer* data = ob_packet->get_buffer();
  if (NULL == data)
  {
    ret = OB_ERROR;
  }

  ObScanParam param;
  if (OB_SUCCESS == ret)
  {
    ret = param.deserialize(data->get_data(), data->get_capacity(), data->get_position());
    if (ret != OB_SUCCESS)
    {
      TBSYS_LOG(ERROR, "%s", "check param failed");
    }
  }

  tbnet::Connection* connection = ob_packet->get_connection();
  ThreadSpecificBuffer::Buffer* thread_buffer = response_packet_buffer_.get_buffer();
  if (NULL == thread_buffer)
  {
    ret = OB_ERROR;
  }
  else
  {
    thread_buffer->reset();
    ObDataBuffer out_buffer(thread_buffer->current(), thread_buffer->remain());

    ObResultCode result_msg;
    result_msg.result_code_ = ret;
    ret = result_msg.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());

    // fake cell
    ObCellInfo cell;
    ObScanner scanner;
    ObRowkey row_key;
    ObString column_name;
    char temp[256] = "";
#if 1
    cell.table_id_ = 101;
    for (uint64_t i = 0; i < 10; ++i)
    {
      snprintf(temp, 256, "chunk_%lu_scan_row_key:%lu", i, i);
      row_key = make_rowkey(temp, &allocator_);
      cell.row_key_ = row_key;
      cell.column_id_ = i + 1;
      cell.value_.set_int(2234 + i);
      scanner.add_cell(cell);
    }
#else
    cell.table_id_ = 123;
    for (uint64_t i = 100; i < 200; ++i)
    {
      snprintf(temp, 256, "row_%lu", i);
      row_key = make_rowkey(temp, &allocator_);
      cell.row_key_ = row_key;
      cell.column_id_ = 101;
      cell.value_.set_int(2234 + i);
      scanner.add_cell(cell);
    }
#endif

    /* begin add by xiaochu */
    //Scanner Range must be set other wise the ms client will report error
    ObNewRange range;
    /*
    /// This will cause rowkey mismatch
    //char *start= "chunk_0_scan_row_key:0";
    //char *end  = "chunk_9_scan_row_key:9";
    */
    char *start= (char*)"row_100";
    char *end  = (char*)"row_200";
    range.start_key_ = make_rowkey(start, &allocator_);;
    range.end_key_ = make_rowkey(end, &allocator_);
    range.table_id_ = 103;
    scanner.set_range(range);
    scanner.set_is_req_fullfilled(true, 10);
    /* end add by xiaochu */

    int32_t channel_id = ob_packet->getChannelId();
    ret = scanner.serialize(out_buffer.get_data(), out_buffer.get_capacity(), out_buffer.get_position());
    ObScannerIterator iter;
    for (iter = scanner.begin(); iter != scanner.end(); ++iter)
    {
      iter.get_cell(cell);
      printf("server_temp:%s\n", to_cstring(cell.row_key_));
    }//
    ret = send_response(OB_SCAN_RESPONSE, 1, out_buffer, connection, channel_id);
  }
  TBSYS_LOG(INFO, "handle scan table result:ret[%d]", ret);
  return ret;
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:94,代码来源:mock_chunk_server.cpp

示例7: get_decoded_scanner

int ObScannerLoader::get_decoded_scanner(ObScanner &param)
{
  ObNewRange range;
  ObString column;
  ObString table_name;
  char value[4096];

  if (config_loaded_)
  {
    TBSYS_LOG(INFO, "creating scanner");

    param.reset();

    range.reset();
    range.table_id_ = table_id_;

    TBSYS_LOG(DEBUG, "range_start_=%s", to_cstring(range_start_));
    TBSYS_LOG(DEBUG, "range_end_=%s", to_cstring(range_end_));

    range.start_key_ = range_start_;
    if (range_start_inclusive_)
      range.border_flag_.set_inclusive_start();
    else
      range.border_flag_.unset_inclusive_start();
    if (range_start_min_)
      range.start_key_.set_min_row();

    range.end_key_ = range_end_;
    if (range_end_inclusive_)
      range.border_flag_.set_inclusive_end();
    else
      range.border_flag_.unset_inclusive_end();
    if (range_end_max_)
      range.end_key_.set_max_row();

    param.set_range(range);
    //param.set_is_req_fullfilled(is_fullfilled_, actual_fullfilled_item_num_);
    param.set_is_req_fullfilled(is_fullfilled_, fullfilled_item_num_);
    param.set_data_version(data_version_);

    FILE *fp = NULL;
    if ((fp = fopen(data_file_name_, "rb")) == NULL) {
      TBSYS_LOG(ERROR, "Fail to open %s", data_file_name_);
    }
    else
    {
      while(fgets(value, 4096, fp))
      {
        /* only digit and string accepted. if not dig, then string */
        int start = 0;
        int end = 0;
        int cnt = 0;
        char buf[4096];
        int table_id = 0;
        int column_cnt = 0;
        ObRowkey row_key;

        while(true)
        {
          while(isspace(value[start]))
          {
            start++;
          }

          end = start;
          while(!isspace(value[end]) && value[end] != '\0')
          {
            end++;
          }


          if (start != end)
          {
            memset(buf, 0, 4096);
            cnt = end - start;
            strncpy(buf, &value[start], cnt);
            buf[cnt] = '\0';
            if (column_cnt == 0)
            {
              table_id = atoi(buf);
            }
            else if(column_cnt == 1)
            {
              // TODO build rowkey
              //strcpy(row_key_buf, buf);
              //row_key.assign(row_key_buf, cnt);
            }
            else
            {
              build_cell_info(table_id, row_key, buf, param);
            }
            column_cnt++;
            start = end;
          }

          if (value[end] == '\0')
          {
            break;
          }
        }
//.........这里部分代码省略.........
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:101,代码来源:ob_scanner_loader.cpp

示例8: if

int ObFakeSqlUpsRpcProxy2::gen_new_scanner(uint64_t table_id, int64_t start_rowkey, int64_t end_rowkey, ObBorderFlag border_flag, ObNewScanner &new_scanner, bool is_fullfilled)
{
    int ret = OB_SUCCESS;
    char rowkey_buf[100];
    ObString rowkey_str;
    ObObj rowkey_obj;
    ObRowkey rowkey;

    ObScanner scanner;

    ObNewRange range;
    range.table_id_ = table_id;
    range.border_flag_ = border_flag;
    gen_new_range(start_rowkey, end_rowkey, range_buf_, range);

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

    ObUpsRow ups_row;
    ObRowDesc row_desc;
    ObObj value;

    if(OB_SUCCESS == ret)
    {
        for(uint64_t i = 0; OB_SUCCESS == ret && i<COLUMN_NUMS; i++)
        {
            if(OB_SUCCESS != (ret = row_desc.add_column_desc(TABLE_ID, i+OB_APP_MIN_COLUMN_ID)))
            {
                TBSYS_LOG(WARN, "add column desc fail:ret[%d]", ret);
            }
        }
        ups_row.set_row_desc(row_desc);
    }

    int64_t start = border_flag.inclusive_start() ? start_rowkey : start_rowkey + 1;
    int64_t end = border_flag.inclusive_end() ? end_rowkey : end_rowkey - 1;

    ObCellInfo cell_info;


    if(OB_SUCCESS == ret)
    {
        for(int64_t i=start; OB_SUCCESS == ret && i<=end; i++)
        {
            sprintf(rowkey_buf, "rowkey_%05ld", i);
            rowkey_str.assign_ptr(rowkey_buf, (int32_t)strlen(rowkey_buf));
            rowkey_obj.set_varchar(rowkey_str);
            rowkey.assign(&rowkey_obj, 1);

            for(int64_t j=0; OB_SUCCESS == ret && j<COLUMN_NUMS; j++)
            {
                cell_info.table_id_ = TABLE_ID;
                cell_info.row_key_ = rowkey;
                cell_info.column_id_ = j+OB_APP_MIN_COLUMN_ID;
                cell_info.value_.set_int(i * 1000 + j);
                if(OB_SUCCESS != (ret = scanner.add_cell(cell_info)))
                {
                    TBSYS_LOG(WARN, "scanner add cell fail:ret[%d]", ret);
                }
            }
        }
    }


    int64_t fullfilled_cell_num = (end - start + 1) * COLUMN_NUMS;

    if(OB_SUCCESS == ret)
    {
        if(OB_SUCCESS != (ret = scanner.set_is_req_fullfilled(is_fullfilled, fullfilled_cell_num)))
        {
            TBSYS_LOG(WARN, "set fullfilled fail:ret[%d]", ret);
        }
        else if(OB_SUCCESS != (ret = ObNewScannerHelper::convert(scanner, &row_desc, new_scanner)))
        {
            TBSYS_LOG(WARN, "convert scanner to new scanner fail:ret[%d]", ret);
        }
    }

    return ret;
}
开发者ID:cuiwm,项目名称:oceanbase,代码行数:82,代码来源:ob_fake_sql_ups_rpc_proxy2.cpp


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