summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@hfmain.(none)>2007-06-14 16:42:43 +0500
committerunknown <holyfoot/hf@hfmain.(none)>2007-06-14 16:42:43 +0500
commit0662a9b78a201a0343004bc3066f8587f49f4e6c (patch)
tree970f3c802c31f6740056dc4d047fed4ec26d9ab9 /sql/item_cmpfunc.cc
parent73016f8f90edecb433e7ebbf09f0b261c19dce84 (diff)
parent167751b3f08295f9cdf752d48af196698867eca3 (diff)
downloadmariadb-git-0662a9b78a201a0343004bc3066f8587f49f4e6c.tar.gz
Merge bk@192.168.21.1:mysql-5.1
into mysql.com:/d2/hf/mrg/mysql-5.1-opt client/mysqltest.c: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/include/mix1.inc: merging mysql-test/r/innodb_mysql.result: merging sql/sql_select.cc: merging
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index fbb6e81c7ec..543bc827c48 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1772,6 +1772,7 @@ void Item_func_between::fix_length_and_dec()
int i;
bool datetime_found= FALSE;
compare_as_dates= TRUE;
+ THD *thd= current_thd;
/*
As some compare functions are generated after sql_yacc,
@@ -1810,6 +1811,23 @@ void Item_func_between::fix_length_and_dec()
ge_cmp.set_datetime_cmp_func(args, args + 1);
le_cmp.set_datetime_cmp_func(args, args + 2);
}
+ else if (args[0]->real_item()->type() == FIELD_ITEM &&
+ thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
+ thd->lex->sql_command != SQLCOM_SHOW_CREATE)
+ {
+ Field *field=((Item_field*) (args[0]->real_item()))->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.
+ }
+ }
}