From 768457911ce2e012ea50690792685a1a7a16fb7e Mon Sep 17 00:00:00 2001 From: "tim@cane.mysql.fi" <> Date: Mon, 15 Jan 2001 21:04:51 +0200 Subject: [PATCH 1/2] Fix get_time bug --- sql/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 639c2def068..aa21c82529e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -328,7 +328,7 @@ bool Field::get_time(TIME *ltime) char buff[40]; String tmp(buff,sizeof(buff)),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || - str_to_time(res->ptr(),res->length(),ltime) == TIMESTAMP_NONE) + str_to_time(res->ptr(),res->length(),ltime)) return 1; return 0; } From bf0557cc7389a190754a9724e69e8184d3938cf0 Mon Sep 17 00:00:00 2001 From: "tim@cane.mysql.fi" <> Date: Mon, 15 Jan 2001 21:21:06 +0200 Subject: [PATCH 2/2] Add test for str_to_time --- mysql-test/r/func_time.result | 2 ++ mysql-test/t/func_time.test | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index c132c7dba8e..79a03bdbd48 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -184,3 +184,5 @@ extract(MINUTE_SECOND FROM "10:11:12") 1112 extract(SECOND FROM "1999-01-02 10:11:12") 12 +ctime hour(ctime) +2001-01-12 12:23:40 12 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 33c62e5a6bf..d6427d121ec 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -98,3 +98,10 @@ select extract(HOUR_SECOND FROM "10:11:12"); select extract(MINUTE FROM "10:11:12"); select extract(MINUTE_SECOND FROM "10:11:12"); select extract(SECOND FROM "1999-01-02 10:11:12"); + +drop table if exists t1; +create table t1 (ctime varchar(20)); +insert into t1 values ('2001-01-12 12:23:40'); +select ctime, hour(ctime) from t1; +drop table t1; +