From 188224d79bc400ad0dd314c0a35003d2f82f787d Mon Sep 17 00:00:00 2001 From: Wan <30400994+wanyue-wy@users.noreply.github.com> Date: Tue, 26 Oct 2021 18:07:47 +0800 Subject: [PATCH] modify the version info (#421) --- src/CMakeLists.txt | 1 + src/share/system_variable/ob_system_variable.cpp | 2 +- src/sql/engine/expr/ob_expr_version.cpp | 7 ++++--- test/mysql_test/test_suite/version/r/mysql/version.result | 6 ++++++ test/mysql_test/test_suite/version/t/version.test | 2 ++ 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 test/mysql_test/test_suite/version/r/mysql/version.result create mode 100644 test/mysql_test/test_suite/version/t/version.test diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa6b984993..4fddfbc136 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,7 @@ target_compile_definitions(ob_base INTERFACE PACKAGE_NAME="${PROJECT_NAME}" PACKAGE_VERSION="${PROJECT_VERSION}" PACKAGE_STRING="${PROJECT_NAME} ${PROJECT_VERSION}" + PACKAGE_VERSION_INFO="${PROJECT_VERSION}-${PROJECT_NAME}" RELEASEID="${OB_RELEASEID}" ) target_compile_options(ob_base INTERFACE diff --git a/src/share/system_variable/ob_system_variable.cpp b/src/share/system_variable/ob_system_variable.cpp index 9d64b8de84..48582e01cf 100644 --- a/src/share/system_variable/ob_system_variable.cpp +++ b/src/share/system_variable/ob_system_variable.cpp @@ -69,7 +69,7 @@ ObSpecialSysVarValues::ObSpecialSysVarValues() ObSpecialSysVarValues::VERSION_MAX_LEN, pos, "%s", - PACKAGE_VERSION))) { + PACKAGE_VERSION_INFO))) { LOG_ERROR("fail to print version to buff", K(ret)); } diff --git a/src/sql/engine/expr/ob_expr_version.cpp b/src/sql/engine/expr/ob_expr_version.cpp index 73e7ee9da8..79e9b05cc8 100644 --- a/src/sql/engine/expr/ob_expr_version.cpp +++ b/src/sql/engine/expr/ob_expr_version.cpp @@ -27,7 +27,7 @@ int ObExprVersion::calc_result_type0(ObExprResType& type, ObExprTypeCtx& type_ct { UNUSED(type_ctx); type.set_varchar(); - type.set_length(static_cast(strlen(PACKAGE_VERSION))); + type.set_length(static_cast(strlen(PACKAGE_VERSION_INFO))); type.set_default_collation_type(); type.set_collation_level(CS_LEVEL_SYSCONST); return OB_SUCCESS; @@ -36,7 +36,8 @@ int ObExprVersion::calc_result_type0(ObExprResType& type, ObExprTypeCtx& type_ct int ObExprVersion::calc_result0(ObObj& result, ObExprCtx& expr_ctx) const { UNUSED(expr_ctx); - result.set_varchar(common::ObString(PACKAGE_VERSION)); + + result.set_varchar(common::ObString(PACKAGE_VERSION_INFO)); result.set_collation(result_type_); return OB_SUCCESS; } @@ -45,7 +46,7 @@ int ObExprVersion::eval_version(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& exp { UNUSED(expr); UNUSED(ctx); - expr_datum.set_string(common::ObString(PACKAGE_VERSION)); + expr_datum.set_string(common::ObString(PACKAGE_VERSION_INFO)); return OB_SUCCESS; } diff --git a/test/mysql_test/test_suite/version/r/mysql/version.result b/test/mysql_test/test_suite/version/r/mysql/version.result new file mode 100644 index 0000000000..66c20b8ed2 --- /dev/null +++ b/test/mysql_test/test_suite/version/r/mysql/version.result @@ -0,0 +1,6 @@ +select version(); +version() +3.1.1-OceanBase CE +show variables like 'version'; +Variable_name Value +version 3.1.1-OceanBase CE diff --git a/test/mysql_test/test_suite/version/t/version.test b/test/mysql_test/test_suite/version/t/version.test new file mode 100644 index 0000000000..cc10857b06 --- /dev/null +++ b/test/mysql_test/test_suite/version/t/version.test @@ -0,0 +1,2 @@ +select version(); +show variables like 'version'; \ No newline at end of file -- GitLab