本文整理汇总了C++中ObObj::set_bool方法的典型用法代码示例。如果您正苦于以下问题:C++ ObObj::set_bool方法的具体用法?C++ ObObj::set_bool怎么用?C++ ObObj::set_bool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObObj
的用法示例。
在下文中一共展示了ObObj::set_bool方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: free
TEST(ObObj,Serialize_bool)
{
ObObj t;
t.set_bool(true);
int64_t len = t.get_serialize_size();
ASSERT_EQ(len,2);
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);
bool r = false;
bool l = false;
ASSERT_EQ(f.get_type(),t.get_type());
f.get_bool(r);
t.get_bool(l);
ASSERT_EQ(r,l);
free(buf);
}
示例2: bool_obj
ObExprObj ObExprObjTest::bool_obj(MyBool t1)
{
ObExprObj ret;
ObObj obj;
switch(t1)
{
case MY_TRUE:
obj.set_bool(true);
break;
case MY_FALSE:
obj.set_bool(false);
break;
default:
obj.set_null();
break;
}
ret.assign(obj);
return ret;
}
示例3: get_basic_param_serialize_size
int64_t ObSqlReadParam::get_basic_param_serialize_size(void) const
{
int64_t total_size = 0;
ObObj obj;
// consistency
obj.set_int(get_is_read_consistency());
total_size += obj.get_serialize_size();
// result cached
obj.set_int(get_is_result_cached());
total_size += obj.get_serialize_size();
// data version
obj.set_int(get_data_version());
total_size += obj.get_serialize_size();
// table id
obj.set_int(table_id_);
total_size += obj.get_serialize_size();
// renamed table id
obj.set_int(renamed_table_id_);
total_size += obj.get_serialize_size();
// only_static_data
obj.set_bool(only_static_data_);
total_size += obj.get_serialize_size();
return total_size;
}
示例4: 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;
}