diff options
author | unknown <lenz@mysql.com> | 2003-06-12 11:06:01 +0200 |
---|---|---|
committer | unknown <lenz@mysql.com> | 2003-06-12 11:06:01 +0200 |
commit | 1273bf20c8ea79d2c74c043c9e1072195b755e5c (patch) | |
tree | 6fd2c5f582ebf65ae2cda14ff69846a2d2065d0a | |
parent | bcdde9a556059d795fc58b491cb34834db393344 (diff) | |
parent | 4885c3ff9d9c8daa93f5c344b6b61ccf9bcbba28 (diff) | |
download | mariadb-git-1273bf20c8ea79d2c74c043c9e1072195b755e5c.tar.gz |
Merge mysql.com:/space/my/mysql-4.0
into mysql.com:/space/my/mysql-4.0-build
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 3 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 2 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 16 | ||||
-rw-r--r-- | sql/item_timefunc.h | 1 |
5 files changed, 23 insertions, 0 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 4617e9d697b..092b6f3f2a5 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -24,6 +24,7 @@ heikki@donna.mysql.fi heikki@hundin.mysql.fi heikki@rescue. heikki@work.mysql.com +hf@deer.(none) hf@deer.mysql.r18.ru hf@genie.(none) igor@hundin.mysql.fi diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 2941352c776..06c0be86667 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -329,6 +329,9 @@ insert into t1 values ('2001-01-12 12:23:40'); select ctime, hour(ctime) from t1; ctime hour(ctime) 2001-01-12 12:23:40 12 +select ctime from t1 where extract(MONTH FROM ctime) = 1 AND extract(YEAR FROM ctime) = 2001; +ctime +2001-01-12 12:23:40 drop table t1; create table t1 (id int); create table t2 (id int, date date); diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index dd589ff2e66..3057729ab96 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -123,6 +123,8 @@ select extract(MONTH FROM "2001-02-00"); create table t1 (ctime varchar(20)); insert into t1 values ('2001-01-12 12:23:40'); select ctime, hour(ctime) from t1; +# test bug 614 (multiple extracts in where) +select ctime from t1 where extract(MONTH FROM ctime) = 1 AND extract(YEAR FROM ctime) = 2001; drop table t1; # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 6a95c15a226..84e7a44ac61 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1137,6 +1137,22 @@ longlong Item_extract::val_int() return 0; // Impossible } +bool Item_extract::eq(const Item *item, bool binary_cmp) const +{ + if (this == item) + return 1; + if (item->type() != FUNC_ITEM || + func_name() != ((Item_func*)item)->func_name()) + return 0; + + Item_extract* ie= (Item_extract*)item; + if (ie->int_type != int_type) + return 0; + + if (!args[0]->eq(ie->args[0], binary_cmp)) + return 0; + return 1; +} void Item_typecast::print(String *str) { diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 0ca2a36609d..e04e24627d9 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -422,6 +422,7 @@ class Item_extract :public Item_int_func longlong val_int(); const char *func_name() const { return "extract"; } void fix_length_and_dec(); + bool eq(const Item *item, bool binary_cmp) const; unsigned int size_of() { return sizeof(*this);} }; |