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


C++ ObExprObj::set_double方法代码示例

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


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

示例1: bool_double

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

示例2: mtime_double

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

示例3: pdatetime_double

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

示例4: snprintf

TEST_F(ObObjCastTest, double_to_xxx)
{
    ObExprObj in;
    char buf[128];
    double cases[] = {-1.1, 0.0, 1.1};
    const char *dec_expected[] = {"-1.100000", "0", "1.100000"};
    for (int64_t i = 0; i < static_cast<int64_t>(ARRAYSIZEOF(cases)); ++i)
    {
        double v = cases[i];
        in.set_double(v);
        snprintf(buf, 128, "%lf", v);

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

示例5: varchar_double

 static int varchar_double(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     int ret = OB_SUCCESS;
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObVarcharType);
     double value = 0.0;
     ret = varchar_scanf(in, 1, "%lf", &value);
     if (OB_SUCCESS == ret)
     {
         out.set_double(value);
     }
     else
     {
         out.set_double(0.0);
         ret = OB_SUCCESS;
     }
     return ret;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:18,代码来源:ob_obj_cast.cpp

示例6: decimal_double

 static int decimal_double(const ObObjCastParams &params, const ObExprObj &in, ObExprObj &out)
 {
     UNUSED(params);
     OB_ASSERT(in.get_type() == ObDecimalType);
     // decimal -> string -> float
     char buf[ObNumber::MAX_PRINTABLE_SIZE];
     memset(buf, 0, ObNumber::MAX_PRINTABLE_SIZE);
     in.get_decimal().to_string(buf, ObNumber::MAX_PRINTABLE_SIZE);
     double v = 0.0;
     if (1 == sscanf(buf, "%lf", &v))
     {
         out.set_double(v);
     }
     else
     {
         out.set_double(0.0);
     }
     return OB_SUCCESS;
 }
开发者ID:b-xiang,项目名称:sql_parser-1,代码行数:19,代码来源:ob_obj_cast.cpp


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