summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mysql.com>2002-11-06 16:21:41 +0100
committerunknown <serg@sergbook.mysql.com>2002-11-06 16:21:41 +0100
commitc5d4041347524e1e4e415db15071fb7dd6aa79ac (patch)
tree066d458d95cd9cffe9746287acc7ae19dc814630 /sql/item_cmpfunc.cc
parentf9b7e3abc8bb0b3440fd2a10e0b201cefb587f4a (diff)
downloadmariadb-git-c5d4041347524e1e4e415db15071fb7dd6aa79ac.tar.gz
BETWEEN fixed
myisam/ft_nlq_search.c: cleanup mysql-test/r/func_time.result: updated
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 79d695eea1e..bf3c0af1ea6 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -350,13 +350,19 @@ void Item_func_between::fix_length_and_dec()
*/
if (!args[0] || !args[1] || !args[2])
return;
- cmp_type=args[0]->result_type();
- if (args[0]->binary)
+ cmp_type=item_cmp_type(args[0]->result_type(),
+ item_cmp_type(args[1]->result_type(),
+ args[2]->result_type()));
+ if (args[0]->binary | args[1]->binary | args[2]->binary)
string_compare=stringcmp;
else
string_compare=sortcmp;
- // Make a special case of compare with fields to get nicer DATE comparisons
+ /*
+ 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;