summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-03-16 15:14:11 +0200
committerunknown <bell@sanja.is.com.ua>2004-03-16 15:14:11 +0200
commit825f5418a1bf632eb5f89af8b5a4a08bf2813e49 (patch)
tree2b438df494ce338f69ea943808d742f214b00370
parent222396165fdfbddae3b481d38426c7b95539a226 (diff)
parent5de92fc753881fcc0d5779c4f01ed8628175d586 (diff)
downloadmariadb-git-825f5418a1bf632eb5f89af8b5a4a08bf2813e49.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-lower_case-4.1
-rw-r--r--mysql-test/r/func_like.result6
-rw-r--r--mysql-test/t/func_like.test8
-rw-r--r--sql/item_cmpfunc.cc7
3 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 7f722622be1..75692738caf 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -46,6 +46,12 @@ select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
a
a\b
drop table t1;
+create table t1 (a datetime);
+insert into t1 values ('2004-03-11 12:00:21');
+select * from t1 where a like '2004-03-11 12:00:21';
+a
+2004-03-11 12:00:21
+drop table t1;
SET NAMES koi8r;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 8b719b077f2..91f55af48cc 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -35,6 +35,14 @@ select * from t1 where a like 'a\\%' escape '#';
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
drop table t1;
+#
+# Bug #2885: like and datetime
+#
+
+create table t1 (a datetime);
+insert into t1 values ('2004-03-11 12:00:21');
+select * from t1 where a like '2004-03-11 12:00:21';
+drop table t1;
#
# Test like with non-default character set
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b56ad6febd4..ac1af32388f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -225,6 +225,13 @@ void Item_bool_func2::fix_length_and_dec()
}
// Make a special case of compare with fields to get nicer DATE comparisons
+
+ if (functype() == LIKE_FUNC) // Disable conversion in case of LIKE function.
+ {
+ set_cmp_func();
+ return;
+ }
+
if (args[0]->type() == FIELD_ITEM)
{
Field *field=((Item_field*) args[0])->field;