本文整理汇总了C++中ObObj::set_null方法的典型用法代码示例。如果您正苦于以下问题:C++ ObObj::set_null方法的具体用法?C++ ObObj::set_null怎么用?C++ ObObj::set_null使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObObj
的用法示例。
在下文中一共展示了ObObj::set_null方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: parse_line
int ObFileTable::parse_line(const ObRow *&row)
{
int ret = OB_SUCCESS;
ObObj value;
int64_t int_value;
ObString str_value;
if (column_count_ == count_)
{
for (int32_t i=0;(OB_SUCCESS == ret) && i<count_;i++)
{
if(0 == strcmp(tokens_[i], "NULL"))
{
value.set_null();
}
else
{
if(ObIntType == column_type_[i])
{
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])
{
str_value.assign_ptr(tokens_[i], strlen(tokens_[i]));
value.set_varchar(str_value);
}
else if(ObExtendType == column_type_[i])
{
value.set_ext(ObActionFlag::OP_DEL_ROW);
}
else
{
ret = OB_ERROR;
TBSYS_LOG(WARN, "unsupport type [%d]", column_type_[i]);
}
}
if(OB_SUCCESS == ret)
{
ret = get_curr_row()->set_cell(table_id_, column_ids_[i], value);
}
}
}
else
{
ret = OB_ERROR;
TBSYS_LOG(WARN, "column_count_[%d], count_[%d]", column_count_, count_);
}
if (OB_SUCCESS == ret)
{
row = get_curr_row();
}
return ret;
}