本文整理汇总了C++中ObObj::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ObObj::serialize方法的具体用法?C++ ObObj::serialize怎么用?C++ ObObj::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObObj
的用法示例。
在下文中一共展示了ObObj::serialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: free
TEST(ObObj,Serialize_int_add)
{
ObObj t;
t.set_int(9900);
int64_t len = t.get_serialize_size();
ASSERT_EQ(len,3);
char *buf = (char *)malloc(len);
int64_t pos = 0;
ASSERT_EQ(t.serialize(buf,len,pos),OB_SUCCESS);
ASSERT_EQ(pos,len);
ObObj f;
pos = 0;
ASSERT_EQ(f.deserialize(buf,len,pos),OB_SUCCESS);
ASSERT_EQ(pos,len);
int64_t r = 0;
int64_t l = 0;
ASSERT_EQ(f.get_type(),t.get_type());
f.get_int(r);
t.get_int(l);
ASSERT_EQ(r,l);
free(buf);
}
示例3: set_str_obj_value
int set_str_obj_value(char * buf, const int64_t buf_len, int64_t & pos, const ObString &value)
{
int ret = OB_SUCCESS;
ObObj obj;
obj.set_varchar(value);
ret = obj.serialize(buf, buf_len, pos);
return ret;
}
示例4: set_int_obj_value
int set_int_obj_value(char * buf, const int64_t buf_len, int64_t & pos, const int64_t value)
{
int ret = OB_SUCCESS;
ObObj obj;
obj.set_int(value);
ret = obj.serialize(buf, buf_len, pos);
return ret;
}
示例5: serialize_int
int ObSqlGetParam::serialize_int(char* buf, const int64_t buf_len, int64_t& pos,
const int64_t value) const
{
int ret = OB_SUCCESS;
ObObj obj;
obj.set_int(value);
ret = obj.serialize(buf, buf_len, pos);
return ret;
}
示例6: 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;
}
示例7:
TEST(ObObj, test_bug)
{
ObObj obj;
obj.set_int(100, false);
char buf[2048];
int64_t len = 2048;
int64_t pos = 0;
ASSERT_EQ(obj.serialize(buf, len, pos), OB_SUCCESS);
pos = 0;
ObObj temp;
temp.set_int(200, true);
temp.reset();
ASSERT_EQ(temp.deserialize(buf, len, pos), OB_SUCCESS);
ASSERT_EQ(temp == obj, true);
ObObj test;
test.set_int(300, true);
test = temp;
ASSERT_EQ(test == temp, true);
}
示例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);
}
示例9: serialize_basic_param
////////////////////// SERIALIZATION ///////////////////////
int ObSqlReadParam::serialize_basic_param(char * buf, const int64_t buf_len, int64_t & pos) const
{
ObObj obj;
int ret = OB_SUCCESS;
// read consistency
if (ret == OB_SUCCESS)
{
obj.set_int(get_is_read_consistency());
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize basic param. buf=%p, buf_len=%ld, pos=%ld, ret=%d", buf, buf_len, pos, ret);
}
}
// result cached
if (ret == OB_SUCCESS)
{
obj.set_int(get_is_result_cached());
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize basic param. buf=%p, buf_len=%ld, pos=%ld, ret=%d", buf, buf_len, pos, ret);
}
}
// data version
if (ret == OB_SUCCESS)
{
obj.set_int(get_data_version());
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize basic param. buf=%p, buf_len=%ld, pos=%ld, ret=%d", buf, buf_len, pos, ret);
}
}
// table id
if (OB_SUCCESS == ret)
{
if (OB_INVALID_ID != table_id_)
{
obj.set_int(table_id_);
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize table id = %lu", table_id_);
}
}
else
{
TBSYS_LOG(WARN, "Invalid table_id_. table_id_=%ld", table_id_);
ret = OB_INVALID_ARGUMENT;
}
}
// renamed table id
if (OB_SUCCESS == ret)
{
if (OB_INVALID_ID != renamed_table_id_)
{
obj.set_int(renamed_table_id_);
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize renamed table id = %lu", renamed_table_id_);
}
}
else
{
TBSYS_LOG(WARN, "Invalid renamed_table_id_. renamed_table_id_=%ld", renamed_table_id_);
ret = OB_INVALID_ARGUMENT;
}
}
if (OB_SUCCESS == ret)
{
obj.set_bool(only_static_data_);
if (OB_SUCCESS != (ret = obj.serialize(buf, buf_len, pos)))
{
TBSYS_LOG(WARN, "fail to serialize bool:ret[%d]", ret);
}
}
return ret;
}