本文整理汇总了C++中ObObj::set_precise_datetime方法的典型用法代码示例。如果您正苦于以下问题:C++ ObObj::set_precise_datetime方法的具体用法?C++ ObObj::set_precise_datetime怎么用?C++ ObObj::set_precise_datetime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObObj
的用法示例。
在下文中一共展示了ObObj::set_precise_datetime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}