summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2006-09-12 19:06:26 +0400
committerevgen@moonbone.local <>2006-09-12 19:06:26 +0400
commit9fb0340a3448fbd70a9f81ca39bea6b645f3a0a7 (patch)
tree3320d542fba4ee017c1fb614834e79518be665a5 /sql
parent31c738d8a2e7bee3f598eb9ba83940644a520775 (diff)
downloadmariadb-git-9fb0340a3448fbd70a9f81ca39bea6b645f3a0a7.tar.gz
item_cmpfunc.cc:
Removed changes to the Item_func_between::fix_length_and_dec() made in the fix for bug#16377 query_cache.result: Corrected a test case after removing a fix for bug#16377
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b766d1e857b..6b6996160a1 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -916,8 +916,30 @@ void Item_func_between::fix_length_and_dec()
if (!args[0] || !args[1] || !args[2])
return;
agg_cmp_type(thd, &cmp_type, args, 3);
- if (cmp_type == STRING_RESULT)
- agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV);
+ if (cmp_type == STRING_RESULT &&
+ agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV))
+ return;
+
+ /*
+ Make a special case of compare with date/time and longlong fields.
+ They are compared as integers, so for const item this time-consuming
+ conversion can be done only once, not for every single comparison
+ */
+ if (args[0]->type() == FIELD_ITEM)
+ {
+ Field *field=((Item_field*) args[0])->field;
+ if (field->can_be_compared_as_longlong())
+ {
+ /*
+ The following can't be recoded with || as convert_constant_item
+ changes the argument
+ */
+ if (convert_constant_item(thd, field,&args[1]))
+ cmp_type=INT_RESULT; // Works for all types.
+ if (convert_constant_item(thd, field,&args[2]))
+ cmp_type=INT_RESULT; // Works for all types.
+ }
+ }
}