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


C++ ObObj::set_ext方法代码示例

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


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

示例1: set_ext_obj_value

 //-------------------------------------------------------------------------------
 int set_ext_obj_value(char * buf, const int64_t buf_len, int64_t & pos, const int64_t value)
 {
   int ret = OB_SUCCESS;
   ObObj obj;
   obj.set_ext(value);
   ret = obj.serialize(buf, buf_len, pos);
   return ret;
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:9,代码来源:ob_common_param.cpp

示例2: get_reserve_param_serialize_size

 int64_t ObReadParam::get_reserve_param_serialize_size(void) const
 {
   ObObj obj;
   // reserve for read master
   obj.set_ext(ObActionFlag::RESERVE_PARAM_FIELD);
   int64_t total_size = obj.get_serialize_size();
   obj.set_int(get_is_read_consistency());
   total_size += obj.get_serialize_size();
   return total_size;
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:10,代码来源:ob_common_param.cpp

示例3: serialize_flag

    int ObSqlGetParam::serialize_flag(char* buf, const int64_t buf_len, int64_t& pos,
        const int64_t flag) const
    {
      int ret = OB_SUCCESS;
      ObObj obj;

      obj.set_ext(flag);
      ret = obj.serialize(buf, buf_len, pos);

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

示例4: serialize_reserve_param

 int ObReadParam::serialize_reserve_param(char * buf, const int64_t buf_len, int64_t & pos) const
 {
   ObObj obj;
   // serialize RESERVER PARAM FIELD
   obj.set_ext(ObActionFlag::RESERVE_PARAM_FIELD);
   int ret = obj.serialize(buf, buf_len, pos);
   if (ret == OB_SUCCESS)
   {
     obj.set_int(get_is_read_consistency());
     ret = obj.serialize(buf, buf_len, pos);
   }
   return ret;
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:13,代码来源:ob_common_param.cpp

示例5: OK

TEST_F(ObRowFuseTest, assign)
{
  uint64_t TABLE_ID = 1000;

  ObRowDesc row_desc;
  for(int i=0;i<8;i++)
  {
    row_desc.add_column_desc(TABLE_ID, OB_APP_MIN_COLUMN_ID + i);
  }

  ObRow row;
  row.set_row_desc(row_desc);
  ObObj value;

  for(int i=0;i<8;i++)
  {
    value.set_int(i);
    OK(row.raw_set_cell(i, value));
  }

  ObRowDesc ups_row_desc;
  for(int i=0;i<4;i++)
  {
    ups_row_desc.add_column_desc(TABLE_ID, OB_APP_MIN_COLUMN_ID + i);
  }

  ObUpsRow ups_row;
  ups_row.set_row_desc(ups_row_desc);

  for(int i=0;i<4;i++)
  {
    value.set_ext(ObActionFlag::OP_NOP);
    OK(ups_row.raw_set_cell(i, value));
  }

  ups_row.set_delete_row(true);
  OK(ObRowFuse::assign(ups_row, row));

  const ObObj *cell = NULL;
  uint64_t table_id = OB_INVALID_ID;
  uint64_t column_id = OB_INVALID_ID;

  for(int i=0;i<4;i++)
  {
    OK(row.raw_get_cell(i, cell, table_id, column_id));
    ASSERT_EQ(ObNullType, cell->get_type());
  }

  ASSERT_TRUE(OB_SUCCESS != row.raw_get_cell(4, cell, table_id, column_id));
}
开发者ID:Abioy,项目名称:oceanbase,代码行数:50,代码来源:ob_row_fuse_test.cpp

示例6: get_obj_serialize_size

    int64_t ObSqlGetParam::get_obj_serialize_size(const int64_t value, bool is_ext) const
    {
      ObObj obj;

      if (is_ext)
      {
        obj.set_ext(value);
      }
      else
      {
        obj.set_int(value);
      }

      return obj.get_serialize_size();
    }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:15,代码来源:ob_sql_get_param.cpp

示例7: get_basic_param_serialize_size

 int64_t ObSqlScanParam::get_basic_param_serialize_size(void) const
 {
   int64_t total_size = 0;
   ObObj obj;
   // BASIC_PARAM_FIELD
   obj.set_ext(ObActionFlag::BASIC_PARAM_FIELD);
   total_size += obj.get_serialize_size();
   // scan range
   obj.set_int(range_.table_id_);
   total_size += obj.get_serialize_size();
   obj.set_int(range_.border_flag_.get_data());
   total_size += obj.get_serialize_size();
   // start_key_
   total_size += get_rowkey_obj_array_size(
       range_.start_key_.get_obj_ptr(), range_.start_key_.get_obj_cnt());
   // end_key_
   total_size += get_rowkey_obj_array_size(
       range_.end_key_.get_obj_ptr(), range_.end_key_.get_obj_cnt());
   obj.set_int(scan_flag_.flag_);
   total_size += obj.get_serialize_size();
   return total_size;
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:22,代码来源:ob_sql_scan_param.cpp

示例8: serialize_end_param

 int ObSqlReadParam::serialize_end_param(char * buf, const int64_t buf_len, int64_t & pos) const
 {
   ObObj obj;
   obj.set_ext(ObActionFlag::END_PARAM_FIELD);
   return obj.serialize(buf, buf_len, pos);
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:6,代码来源:ob_sql_read_param.cpp

示例9: get_end_param_serialize_size

 int64_t ObSqlScanParam::get_end_param_serialize_size(void) const
 {
   ObObj obj;
   obj.set_ext(ObActionFlag::END_PARAM_FIELD);
   return obj.get_serialize_size();
 }
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:6,代码来源:ob_sql_scan_param.cpp

示例10: build_cell_

void CellinfoBuilder::build_cell_(struct drand48_data &rand_data, const ObString &row_key, const ObSchema &schema,
                                  ObObj &obj, int64_t &column_pos, int &op_type,
                                  PageArena<char> &allocer)
{
  const ObColumnSchema *column_schema = schema.column_begin();
  int64_t column_num = schema.column_end() - schema.column_begin();
  int64_t rand = 0;

  lrand48_r(&rand_data, &rand);
  op_type = calc_op_type_(rand);
  //while (true)
  //{
  //  lrand48_r(&rand_data, &rand);
  //  column_pos = range_rand(0, column_num - 3, rand);
  //  if (ObIntType <= column_schema[column_pos].get_type()
  //      && ObVarcharType >= column_schema[column_pos].get_type())
  //  {
  //    break;
  //  }
  //}
  column_pos=0;

  lrand48_r(&rand_data, &rand);
  switch (column_schema[column_pos].get_type())
  {
    case ObIntType:
      {
        int64_t tmp = rand;
        obj.set_int(tmp, ADD == op_type);
        break;
      }
    case ObFloatType:
      {
        float tmp = static_cast<float>(rand);
        obj.set_float(tmp, ADD == op_type);
        break;
      }
    case ObDoubleType:
      {
        double tmp = static_cast<double>(rand);
        obj.set_double(tmp, ADD == op_type);
        break;
      }
    case ObDateTimeType:
      {
        ObDateTime tmp = static_cast<ObDateTime>(rand);
        obj.set_datetime(tmp, ADD == op_type);
        break;
      }
    case ObPreciseDateTimeType:
      {
        ObPreciseDateTime tmp = static_cast<ObPreciseDateTime>(rand);
        obj.set_precise_datetime(tmp, ADD == op_type);
        break;
      }
    case ObVarcharType:
      {
        int64_t length = range_rand(1, column_schema[column_pos].get_size(), rand);
        char *ptr = allocer.alloc(length);
        build_string(ptr, length, rand);
        ObString str;
        str.assign_ptr(ptr, length);
        if (ADD == op_type)
        {
          op_type = UPDATE;
        }
        obj.set_varchar(str);
        break;
      }
    default:
      break;
  }
  if (DEL_CELL == op_type)
  {
    obj.set_null();
  }
  else if (DEL_ROW == op_type)
  {
    obj.set_ext(ObActionFlag::OP_DEL_ROW);
  }
}
开发者ID:CCoder123,项目名称:pproj,代码行数:81,代码来源:cellinfo_builder.cpp

示例11: parse_line

int ObUpsFileTable::parse_line(const ObRow *&row)
{
  int ret = OB_SUCCESS;
  ObObj value;
  int64_t int_value;
  ObString str_value;

  if (column_count_ + 1 == count_)
  {

    for (int32_t i=1;(OB_SUCCESS == ret) && i<count_;i++)
    {
      if( tokens_[0][0] == '-' )
      {
        curr_ups_row_.set_delete_row(true);
      }
      else
      {
        curr_ups_row_.set_delete_row(false);
      }

      if(0 == strcmp(tokens_[i], "NOP"))
      {
        value.set_ext(ObActionFlag::OP_NOP);
      }
      else
      {
        if(ObIntType == column_type_[i-1])
        {
          bool is_add = false;
          if( tokens_[i][strlen(tokens_[i]) - 1] == '+' )
          {
            tokens_[i][strlen(tokens_[i]) - 1] = '\0';
            is_add = true;
          }
          int_value = atoi(tokens_[i]);
          value.set_int(int_value, is_add);
        }
        else if(ObVarcharType == column_type_[i-1])
        {
          str_value.assign_ptr(tokens_[i], strlen(tokens_[i]));
          value.set_varchar(str_value);
        }
        else if(ObExtendType == column_type_[i-1])
        {
          value.set_ext(ObActionFlag::OP_DEL_ROW);
        }
        else
        {
          ret = OB_ERROR;
          TBSYS_LOG(WARN, "unsupport type [%d]", column_type_[i-1]);
        }
      }

      if(OB_SUCCESS == ret)
      {
        ret = curr_ups_row_.set_cell(table_id_, column_ids_[i-1], value);
      }
    }
  }
  else
  {
    ret = OB_ERROR;
    TBSYS_LOG(WARN, "column_count_[%d], count_[%d], line_[%s]", column_count_, count_, line_);
  }

  if (OB_SUCCESS == ret)
  {
    row = &curr_ups_row_;
  }
  return ret;
}
开发者ID:Abioy,项目名称:oceanbase,代码行数:72,代码来源:ob_ups_file_table.cpp

示例12:

// ObRow.reset
TEST_F(ObRowTest, reset_test)
{
  ObRow row;
  ObRowDesc row_desc;
  const uint64_t TABLE_ID = 1001;
  const int64_t COLUMN_NUM = 8;
  ObObj cell;
  const ObObj *value = NULL;
  uint64_t table_id = 0;
  uint64_t column_id = 0;
  int64_t int_value = 0;

  row_desc.set_rowkey_cell_count(2);

  for (int i = 0; i < COLUMN_NUM; i ++)
  {
    row_desc.add_column_desc(TABLE_ID, OB_APP_MIN_COLUMN_ID + i);
  }
  row.set_row_desc(row_desc);

  for (int i = 0; i < COLUMN_NUM; i ++)
  {
    cell.set_int(i);
    row.raw_set_cell(i, cell);
  }

  row.reset(true, ObRow::DEFAULT_NULL);
  for (int i = 0; i < row_desc.get_rowkey_cell_count(); i ++)
  {
    row.raw_get_cell(i, value, table_id, column_id);
    value->get_int(int_value);
    ASSERT_EQ(i, int_value);
  }

  for (int64_t i = row_desc.get_rowkey_cell_count(); i < COLUMN_NUM; i ++)
  {
    row.raw_get_cell(i, value, table_id, column_id);
    ASSERT_TRUE( ObNullType == value->get_type() );
  }

  row_desc.add_column_desc(OB_INVALID_ID, OB_ACTION_FLAG_COLUMN_ID);
  cell.set_ext(ObActionFlag::OP_DEL_ROW);
  row.set_cell(OB_INVALID_ID, OB_ACTION_FLAG_COLUMN_ID, cell);

  row.reset(true, ObRow::DEFAULT_NOP);

  for (int i = 0; i < row_desc.get_rowkey_cell_count(); i ++)
  {
    row.raw_get_cell(i, value, table_id, column_id);
    value->get_int(int_value);
    ASSERT_EQ(i, int_value);
  }

  for (int64_t i = row_desc.get_rowkey_cell_count(); i < COLUMN_NUM; i ++)
  {
    row.raw_get_cell(i, value, table_id, column_id);
    ASSERT_TRUE( ObActionFlag::OP_NOP == value->get_ext() ) << "ext value: " << value->get_ext();
  }

  row.get_cell(OB_INVALID_ID, OB_ACTION_FLAG_COLUMN_ID, value);
  ASSERT_TRUE( ObActionFlag::OP_ROW_DOES_NOT_EXIST == value->get_ext() );
}
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:63,代码来源:ob_row_test.cpp


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