summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-03-07 22:11:57 +0300
committerevgen@moonbone.local <>2007-03-07 22:11:57 +0300
commitb81b814cd180d4d1963a57201758e47b04c21bcf (patch)
tree73c940c0964ba2fb7693501a744126263a1ec8e0 /sql/item_func.cc
parentf48237929667647fdaca35768070d318cbd92397 (diff)
downloadmariadb-git-b81b814cd180d4d1963a57201758e47b04c21bcf.tar.gz
Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
result. For built-in functions like sqrt() function names are hard-coded and can be compared by pointer. But this isn't the case for a used-defined stored functions - names there are dynamical and should be compared as strings. Now the Item_func::eq() function employs my_strcasecmp() function to compare used-defined stored functions names.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 638d8903dcb..c8c0671ae1d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -409,8 +409,13 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const
if (item->type() != FUNC_ITEM)
return 0;
Item_func *item_func=(Item_func*) item;
- if (arg_count != item_func->arg_count ||
- func_name() != item_func->func_name())
+ Item_func::Functype func_type;
+ if ((func_type= functype()) != item_func->functype() ||
+ arg_count != item_func->arg_count ||
+ (func_type != Item_func::FUNC_SP &&
+ func_name() != item_func->func_name()) ||
+ (func_type == Item_func::FUNC_SP &&
+ my_strcasecmp(system_charset_info, func_name(), item_func->func_name())))
return 0;
for (uint i=0; i < arg_count ; i++)
if (!args[i]->eq(item_func->args[i], binary_cmp))