summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tnurnberg@white.intern.koehntopp.de>2007-12-20 08:32:51 +0100
committerunknown <tnurnberg@white.intern.koehntopp.de>2007-12-20 08:32:51 +0100
commit3a13408f8547b0f15952b8fd909bcc527910cc1a (patch)
treec40db0891ce6035f13157b94c5cfe88392cc8ec0
parent82e026c1462dc2b5971bb83efffa5a82492dc1e7 (diff)
parent473d424782e46f4870605bdf482cd5f7e242e7a9 (diff)
downloadmariadb-git-3a13408f8547b0f15952b8fd909bcc527910cc1a.tar.gz
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into mysql.com:/misc/mysql/31990/51-31990 mysql-test/r/type_date.result: Auto merged mysql-test/t/cast.test: Auto merged mysql-test/t/type_date.test: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item_timefunc.cc: Auto merged
-rw-r--r--mysql-test/r/type_date.result5
-rw-r--r--mysql-test/t/type_date.test8
-rw-r--r--sql/field.cc7
-rw-r--r--sql/field.h1
4 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 5921991bf50..7cb71831bce 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -260,6 +260,11 @@ INSERT INTO t1 VALUES ('1000-00-00');
ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
+CREATE TABLE t1 SELECT curdate() AS f1;
+SELECT hour(f1), minute(f1), second(f1) FROM t1;
+hour(f1) minute(f1) second(f1)
+0 0 0
+DROP TABLE t1;
End of 5.0 tests
create table t1 (a date, primary key (a))engine=memory;
insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index d714229c217..9bc428c3715 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -213,6 +213,14 @@ INSERT INTO t1 VALUES ('1000-00-00');
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
+#
+# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE
+#
+
+CREATE TABLE t1 SELECT curdate() AS f1;
+SELECT hour(f1), minute(f1), second(f1) FROM t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
#
diff --git a/sql/field.cc b/sql/field.cc
index 93588992fed..52168e713aa 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5636,6 +5636,13 @@ String *Field_date::val_str(String *val_buffer,
}
+bool Field_date::get_time(MYSQL_TIME *ltime)
+{
+ bzero((char *)ltime, sizeof(MYSQL_TIME));
+ return 0;
+}
+
+
int Field_date::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
int32 a,b;
diff --git a/sql/field.h b/sql/field.h
index 9f76deb18bc..27be2601270 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1240,6 +1240,7 @@ public:
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
+ bool get_time(MYSQL_TIME *ltime);
bool send_binary(Protocol *protocol);
int cmp(const uchar *,const uchar *);
void sort_string(uchar *buff,uint length);