From 58adb70a8bd43550a7e5d9e1b0226a7966742f63 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2005 14:56:17 +0300 Subject: [PATCH] fixed time_format printing (BUG#7521) mysql-test/r/view.result: using time_format in view (BUG#7521) mysql-test/t/view.test: using time_format in view (BUG#7521) sql/item_timefunc.h: fixed func_name reportion --- mysql-test/r/view.result | 5 +++++ mysql-test/t/view.test | 7 +++++++ sql/item_timefunc.h | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index b178af1bb1c..9ec2ecee090 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1743,3 +1743,8 @@ select * from v1; cast(1 as decimal) 1.00 drop view v1; +create view v1 as SELECT TIME_FORMAT(SEC_TO_TIME(3600),'%H:%i') as t; +select * from v1; +t +01:00 +drop view v1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 23d482254d1..a1f4b67dc9b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1587,3 +1587,10 @@ drop table t1; create view v1 as select cast(1 as decimal); select * from v1; drop view v1; + +# +# using time_format in view (BUG#7521) +# +create view v1 as SELECT TIME_FORMAT(SEC_TO_TIME(3600),'%H:%i') as t; +select * from v1; +drop view v1; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 5c172b4698b..a6dd9f7da91 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -503,7 +503,8 @@ public: Item_func_date_format(Item *a,Item *b,bool is_time_format_arg) :Item_str_func(a,b),is_time_format(is_time_format_arg) {} String *val_str(String *str); - const char *func_name() const { return "date_format"; } + const char *func_name() const + { return is_time_format ? "time_format" : "date_format"; } void fix_length_and_dec(); uint format_length(const String *format); };