当前位置: 首页>>代码示例>>C++>>正文


C++ ObExprObj类代码示例

本文整理汇总了C++中ObExprObj的典型用法代码示例。如果您正苦于以下问题:C++ ObExprObj类的具体用法?C++ ObExprObj怎么用?C++ ObExprObj使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObExprObj类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(ObObjCastTest, bool_to_xxx)
{
    ObExprObj in;
    bool cases[] = {true, false};
    const char *varchar_expected[] = {"true", "false"};
    const char *dec_expected[] = {"1", "0"};
    for (int64_t i = 0; i < static_cast<int64_t>(ARRAYSIZEOF(cases)); ++i)
    {
        bool v = cases[i];
        in.set_bool(v);

        MY_EXPECT(ObBoolType, in, ObNullType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObIntType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObFloatType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObDoubleType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObDateTimeType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObPreciseDateTimeType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObVarcharType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObSeqType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObCreateTimeType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObModifyTimeType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObExtendType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObBoolType, v, varchar_expected[i]);
        MY_EXPECT(ObBoolType, in, ObDecimalType, v, dec_expected[i]);
    }
}
开发者ID:sharpglasses,项目名称:oceanbase,代码行数:26,代码来源:ob_obj_cast_test.cpp

示例2: double_mtime

 static int double_mtime(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObDoubleType);
     out.set_mtime(static_cast<ObModifyTime> (in.get_double()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例3: bool_ctime

 static int bool_ctime(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObBoolType);
     out.set_ctime(static_cast<ObCreateTime> (in.get_bool()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例4: int_datetime

 static int int_datetime(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObIntType);
     out.set_datetime(static_cast<ObDateTime> (in.get_int()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例5: double_int

 static int double_int(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObDoubleType);
     out.set_int(static_cast<int64_t> (in.get_double()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例6: ctime_float

 static int ctime_float(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObCreateTimeType);
     out.set_float(static_cast<float> (in.get_ctime()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例7: ctime_datetime

 static int ctime_datetime(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObCreateTimeType);
     out.set_datetime(static_cast<ObDateTime> (in.get_ctime() / 1000000L));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例8: float_double

 static int float_double(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObFloatType);
     out.set_double(static_cast<double> (in.get_float()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例9: obj_cast

 int obj_cast(const ObObj &orig_cell, const ObObj &expected_type,
         ObObj &casted_cell, const ObObj *&res_cell)
 {
     int ret = OB_SUCCESS;
     if (orig_cell.get_type() != expected_type.get_type())
     {
         // type cast
         ObObjCastParams params;
         ObExprObj from;
         ObExprObj to;
         from.assign(orig_cell);
         to.assign(casted_cell);
         if (OB_SUCCESS != (ret = OB_OBJ_CAST[orig_cell.get_type()][expected_type.get_type()](params, from, to)))
         {
             jlog(WARNING, "failed to type cast obj, err=%d", ret);
         }
         else if (OB_SUCCESS != (ret = to.to(casted_cell)))
         {
             jlog(WARNING, "failed to convert expr_obj to obj, err=%d", ret);
         }
         else
         {
             res_cell = &casted_cell;
         }
     }
     else
     {
         res_cell = &orig_cell;
     }
     return ret;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:31,代码来源:ob_obj_cast.cpp

示例10: decimal_bool

 static int decimal_bool(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObDecimalType);
     out.set_bool(!in.get_decimal().is_zero());
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例11: mtime_pdatetime

 static int mtime_pdatetime(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObModifyTimeType);
     out.set_precise_datetime(static_cast<ObPreciseDateTime> (in.get_mtime()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例12: bool_float

 static int bool_float(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObBoolType);
     out.set_float(static_cast<float> (in.get_bool()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例13: mtime_bool

 static int mtime_bool(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObModifyTimeType);
     out.set_bool(static_cast<bool> (in.get_mtime()));
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:7,代码来源:ob_obj_cast.cpp

示例14: int_varchar

 static int int_varchar(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     int ret = OB_SUCCESS;
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObIntType);
     ret = varchar_printf(out, "%ld", in.get_int());
     return ret;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:8,代码来源:ob_obj_cast.cpp

示例15: int_decimal

 static int int_decimal(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObIntType);
     ObNumber num;
     num.from(in.get_int());
     out.set_decimal(num); // @todo optimize
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:9,代码来源:ob_obj_cast.cpp


注:本文中的ObExprObj类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。