Commit 902775b3 authored by Sergey Glukhov's avatar Sergey Glukhov

5.1-bugteam->mysql_trunk-merge merge

parents 7e336524 fe5d5495
...@@ -139,6 +139,16 @@ CAST(c AS TIME) ...@@ -139,6 +139,16 @@ CAST(c AS TIME)
00:00:00 00:00:00
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
#
# Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
#
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES ('23:38:57');
SELECT TIMESTAMP(f1,'1') FROM t1;
TIMESTAMP(f1,'1')
NULL
DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (f1 TIME); CREATE TABLE t1 (f1 TIME);
INSERT INTO t1 VALUES ('24:00:00'); INSERT INTO t1 VALUES ('24:00:00');
SELECT '24:00:00' = (SELECT f1 FROM t1); SELECT '24:00:00' = (SELECT f1 FROM t1);
......
...@@ -88,9 +88,18 @@ INSERT INTO t1 VALUES ('0:00:00'); ...@@ -88,9 +88,18 @@ INSERT INTO t1 VALUES ('0:00:00');
SELECT CAST(c AS TIME) FROM t1; SELECT CAST(c AS TIME) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
--echo #
--echo # Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
--echo #
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES ('23:38:57');
SELECT TIMESTAMP(f1,'1') FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
# #
# Bug#42664 - Sign ignored for TIME types when not comparing as longlong # Bug#42664 - Sign ignored for TIME types when not comparing as longlong
......
...@@ -5268,7 +5268,6 @@ String *Field_time::val_str(String *val_buffer, ...@@ -5268,7 +5268,6 @@ String *Field_time::val_str(String *val_buffer,
bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate) bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
{ {
long tmp;
THD *thd= table ? table->in_use : current_thd; THD *thd= table ? table->in_use : current_thd;
if (!(fuzzydate & TIME_FUZZY_DATE)) if (!(fuzzydate & TIME_FUZZY_DATE))
{ {
...@@ -5278,19 +5277,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate) ...@@ -5278,19 +5277,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
thd->warning_info->current_row_for_warning()); thd->warning_info->current_row_for_warning());
return 1; return 1;
} }
tmp=(long) sint3korr(ptr); return Field_time::get_time(ltime);
ltime->neg=0;
if (tmp < 0)
{
ltime->neg= 1;
tmp=-tmp;
}
ltime->hour=tmp/10000;
tmp-=ltime->hour*10000;
ltime->minute= tmp/100;
ltime->second= tmp % 100;
ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment