summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-06-11 00:16:00 +0400
committerunknown <evgen@moonbone.local>2007-06-11 00:16:00 +0400
commit237a1d22f1955d015ffa3f958d4c3f25078559c8 (patch)
tree387ae7083c1c43ac2d17f79b83bd3c85fb65fc16 /sql/item_cmpfunc.cc
parenta7f5132591f631f5141522bca27cbdfda9a6020e (diff)
parent88d5c0146b78ddee5816fc256e9b2b0635df2445 (diff)
downloadmariadb-git-237a1d22f1955d015ffa3f958d4c3f25078559c8.tar.gz
Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql mysql-test/r/gis.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/t/gis.test: Auto merged mysql-test/t/subselect.test: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/sql_insert.cc: Auto merged mysql-test/include/mix1.inc: Manually merged mysql-test/r/innodb_mysql.result: Manually merged mysql-test/r/type_datetime.result: Manually merged mysql-test/t/type_datetime.test: Manually merged sql/field.h: Manually merged sql/sql_select.cc: Manually merged sql/sql_yacc.yy: Manually merged tests/mysql_client_test.c: Manually merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b8117f53d6b..19809ed08c7 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1810,6 +1810,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.
+ }
+ }
}