patch 4.0
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#ifndef UNITTEST_STORAGE_OB_ROW_GENERATE_ADAPTER_H_
|
||||
#define UNITTEST_STORAGE_OB_ROW_GENERATE_ADAPTER_H_
|
||||
|
||||
|
||||
#include "common/object/ob_object.h"
|
||||
#include "storage/ob_i_store.h"
|
||||
#include "common/row/ob_row_store.h"
|
||||
@ -22,49 +23,49 @@
|
||||
#include "storage/ob_i_store.h"
|
||||
#include "blocksstable/ob_row_generate.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
|
||||
using namespace blocksstable;
|
||||
|
||||
namespace common {
|
||||
namespace common
|
||||
{
|
||||
|
||||
|
||||
class ObMockIterWithLimit : public ObNewRowIterator {
|
||||
public:
|
||||
ObMockIterWithLimit() : need_row_count_(0), got_row_count_(0){};
|
||||
~ObMockIterWithLimit(){};
|
||||
ObMockIterWithLimit() : need_row_count_(0), got_row_count_(0) {};
|
||||
~ObMockIterWithLimit() {};
|
||||
|
||||
void set_need_row_count(int64_t count)
|
||||
{
|
||||
void set_need_row_count(int64_t count) {
|
||||
need_row_count_ = count;
|
||||
}
|
||||
|
||||
int64_t get_need_row_count()
|
||||
{
|
||||
int64_t get_need_row_count() {
|
||||
return need_row_count_;
|
||||
}
|
||||
|
||||
bool is_iter_end()
|
||||
{
|
||||
bool is_iter_end() {
|
||||
return need_row_count_ == got_row_count_;
|
||||
}
|
||||
|
||||
protected:
|
||||
void advance_iter()
|
||||
{
|
||||
++got_row_count_;
|
||||
}
|
||||
|
||||
void advance_iter() {
|
||||
++got_row_count_;
|
||||
}
|
||||
|
||||
int64_t need_row_count_;
|
||||
int64_t got_row_count_;
|
||||
};
|
||||
|
||||
class ObRowGenerateAdapter : public ObMockIterWithLimit {
|
||||
class ObRowGenerateAdapter : public ObMockIterWithLimit{
|
||||
|
||||
public:
|
||||
ObRowGenerateAdapter(){};
|
||||
~ObRowGenerateAdapter(){};
|
||||
ObRowGenerateAdapter() {};
|
||||
~ObRowGenerateAdapter() {};
|
||||
|
||||
virtual int get_next_row(ObNewRow*& row)
|
||||
virtual int get_next_row(ObNewRow *&row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (is_iter_end()) {
|
||||
@ -77,10 +78,10 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int init(const share::schema::ObTableSchema& src_schema, ObIAllocator& buf)
|
||||
int init(const share::schema::ObTableSchema &src_schema, ObIAllocator &buf)
|
||||
{
|
||||
new_row_.row_val_.count_ = src_schema.get_column_count();
|
||||
new_row_.row_val_.cells_ = static_cast<ObObj*>(buf.alloc(new_row_.row_val_.count_ * sizeof(ObObj)));
|
||||
new_row_.row_val_.cells_ = static_cast<ObObj *>(buf.alloc(new_row_.row_val_.count_ * sizeof(ObObj)));
|
||||
return generate_.init(src_schema);
|
||||
}
|
||||
|
||||
@ -94,6 +95,8 @@ private:
|
||||
ObStoreRow new_row_;
|
||||
};
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
#endif // OCEANBASE_UNITTEST_MOCK_ITERATOR_H_
|
||||
} // namespace unittest
|
||||
} // namespace oceanbase
|
||||
#endif // OCEANBASE_UNITTEST_MOCK_ITERATOR_H_
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user