summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-06-20 14:56:17 +0300
committerunknown <bell@sanja.is.com.ua>2005-06-20 14:56:17 +0300
commit58adb70a8bd43550a7e5d9e1b0226a7966742f63 (patch)
tree96f81cd1c939ca0d139720f8df06fb4db9ef289d
parent2ccb51061b31d1537bd3f7d32ea0ed2132fdc7f4 (diff)
downloadmariadb-git-58adb70a8bd43550a7e5d9e1b0226a7966742f63.tar.gz
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
-rw-r--r--mysql-test/r/view.result5
-rw-r--r--mysql-test/t/view.test7
-rw-r--r--sql/item_timefunc.h3
3 files changed, 14 insertions, 1 deletions
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);
};