From 6a72b28bab4f5c598671af895f5cc9d0bcdfee00 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Sat, 6 Oct 2018 11:27:51 +0100 Subject: [PATCH] MCOL-1775 Fix addtime/subtime for WHERE MariaDB server renamed addtime/subtime so we need to use the new names for these functions. --- dbcon/mysql/ha_calpont_execplan.cpp | 12 +++++++++--- utils/funcexp/funcexp.cpp | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 3b109ade0..a4d3bb91b 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -3665,11 +3665,17 @@ ReturnedColumn* buildFunctionColumn( gwi.no_parm_func_list.push_back(fc); } - // add the sign for addtime function - if (funcName == "add_time") + // func name is addtime/subtime in 10.3.9 + // note: this means get_time() can now go away in our server fork + if ((funcName == "addtime") || (funcName == "subtime")) { + int64_t sign = 1; + if (funcName == "subtime") + { + sign = -1; + } Item_func_add_time* addtime = (Item_func_add_time*)ifp; - sptp.reset(new ParseTree(new ConstantColumn((int64_t)addtime->get_sign()))); + sptp.reset(new ParseTree(new ConstantColumn(sign))); funcParms.push_back(sptp); } diff --git a/utils/funcexp/funcexp.cpp b/utils/funcexp/funcexp.cpp index 66782cc54..53f7da595 100644 --- a/utils/funcexp/funcexp.cpp +++ b/utils/funcexp/funcexp.cpp @@ -75,6 +75,8 @@ FuncExp::FuncExp() fFuncMap["abs"] = new Func_abs(); fFuncMap["acos"] = new Func_acos(); fFuncMap["add_time"] = new Func_add_time(); + fFuncMap["addtime"] = new Func_add_time(); + fFuncMap["subtime"] = new Func_add_time(); fFuncMap["asin"] = new Func_asin(); fFuncMap["ascii"] = new Func_ascii(); fFuncMap["atan"] = new Func_atan();