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


C++ BlockInfo::get_buffer方法代码示例

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


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

示例1: append_row

int ObRowStore::append_row(const ObRowkey *rowkey, const ObRow &row, BlockInfo &block, StoredRow &stored_row)
{
  int ret = OB_SUCCESS;

  const int64_t reserved_columns_count = reserved_columns_.count();
  ObCompactCellWriter cell_writer;

  if(NULL == rowkey)
  {
    cell_writer.init(block.get_buffer(), block.get_remain_size(), SPARSE);
  }
  else
  {
    cell_writer.init(block.get_buffer(), block.get_remain_size(), DENSE_SPARSE);
  }

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

  const ObUpsRow *ups_row = dynamic_cast<const ObUpsRow *>(&row);
  if(OB_SUCCESS == ret && NULL != rowkey)
  {
    if(OB_SUCCESS != (ret = cell_writer.append_rowkey(*rowkey)))
    {
      TBSYS_LOG(WARN, "append rowkey fail:ret[%d]", ret);
    }
  }

  if(OB_SUCCESS == ret && NULL != ups_row)
  {
    if( ups_row->get_is_delete_row() )
    {
      if(OB_SUCCESS != (ret = cell_writer.row_delete()))
      {
        TBSYS_LOG(WARN, "append row delete flag fail:ret[%d]", ret);
      }
    }
  }

  int64_t ext_value = 0;

  for (int64_t i = 0; OB_SUCCESS == ret && i < row.get_column_num(); ++i)
  {
    if (OB_SUCCESS != (ret = row.raw_get_cell(i, cell, table_id, column_id)))
    {
      TBSYS_LOG(WARN, "failed to get cell, err=%d", ret);
      break;
    }
    if (OB_SUCCESS == ret)
    {
      if (ObExtendType == cell->get_type())
      {
        if(OB_SUCCESS != (ret = cell->get_ext(ext_value)))
        {
          TBSYS_LOG(WARN, "get ext value fail:ret[%d]", ret);
        }
        else if (ObActionFlag::OP_VALID == ext_value)
        {
          if (OB_SUCCESS != (ret = cell_writer.append_escape(ObCellMeta::ES_VALID)))
          {
            TBSYS_LOG(WARN, "fail to append escape:ret[%d]", ret);
          }
        }
        else if (ObActionFlag::OP_ROW_DOES_NOT_EXIST == ext_value)
        {
          if (OB_SUCCESS != (ret = cell_writer.append_escape(ObCellMeta::ES_NOT_EXIST_ROW)))
          {
            TBSYS_LOG(WARN, "fail to append escape:ret[%d]", ret);
          }
        }
        else if(ObActionFlag::OP_NOP != ext_value)
        {
          ret = OB_NOT_SUPPORTED;
          TBSYS_LOG(WARN, "not supported ext value:ext[%ld]", ext_value);
        }
        else if(NULL == ups_row)
        {
          ret = OB_NOT_SUPPORTED;
          TBSYS_LOG(WARN, "OP_NOP can only used in ups row");
        }
        else //OP_NOP不需要序列化
        {
          cell_clone = *cell;
        }
      }
      else if (OB_SUCCESS != (ret = cell_writer.append(column_id, *cell, &cell_clone)))
      {
        if (OB_BUF_NOT_ENOUGH != ret)
        {
          TBSYS_LOG(WARN, "failed to append cell, err=%d", ret);
        }
        break;
      }
    }
    if (OB_SUCCESS == ret)
    {
      // whether reserve this cell
      for (int32_t j = 0; j < reserved_columns_count; ++j)
//.........这里部分代码省略.........
开发者ID:Alibaba-boonya,项目名称:oceanbase,代码行数:101,代码来源:ob_row_store.cpp


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