summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2006-06-06 09:10:28 +0500
committerunknown <ramil@mysql.com>2006-06-06 09:10:28 +0500
commitf1b1c0eb3f916591c059da8c21334e848ae75b43 (patch)
treeb24038ea3302442ca3377f1f04569ca6251002f0
parent00ad00deef1ebc8d912866b7743720eef28d6e9c (diff)
parent409fb4895fd08e876b33c4d809919952871996a9 (diff)
downloadmariadb-git-f1b1c0eb3f916591c059da8c21334e848ae75b43.tar.gz
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1.b16546 sql/item_timefunc.cc: Auto merged mysql-test/r/func_time.result: merging mysql-test/t/func_time.test: merging
-rw-r--r--mysql-test/r/func_time.result12
-rw-r--r--mysql-test/t/func_time.test7
-rw-r--r--sql/item_timefunc.cc6
-rw-r--r--sql/item_timefunc.h1
4 files changed, 19 insertions, 7 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 02f3d2f7273..3dcdf535038 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -7,20 +7,20 @@ period_add("9602",-12) period_diff(199505,"9404")
199502 13
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now())
-0 0 0
+0.000000 0 0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
-1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
+1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112.000000
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21)
-02:30:01 23001 54742 00:04:57
+02:30:01 23001.000000 54742 00:04:57
select sec_to_time(time_to_sec('-838:59:59'));
sec_to_time(time_to_sec('-838:59:59'))
-838:59:59
select now()-curdate()*1000000-curtime();
now()-curdate()*1000000-curtime()
-0
+0.000000
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
strcmp(current_timestamp(),concat(current_date()," ",current_time()))
0
@@ -630,3 +630,7 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
NULL NULL January NULL
+select now() - now() + 0, curtime() - curtime() + 0,
+sec_to_time(1) + 0, from_unixtime(1) + 0;
+now() - now() + 0 curtime() - curtime() + 0 sec_to_time(1) + 0 from_unixtime(1) + 0
+0.000000 0.000000 1.000000 19700101030001.000000
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 01e4e47d318..f7012021705 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -322,4 +322,11 @@ select last_day('2005-01-00');
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
+#
+# Bug #16546
+#
+
+select now() - now() + 0, curtime() - curtime() + 0,
+ sec_to_time(1) + 0, from_unixtime(1) + 0;
+
# End of 4.1 tests
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 5fdbd968df1..7ab3936d700 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1373,7 +1373,7 @@ void Item_func_curtime::fix_length_and_dec()
{
TIME ltime;
- decimals=0;
+ decimals= DATETIME_DEC;
collation.set(&my_charset_bin);
store_now_in_TIME(&ltime);
value= TIME_to_ulonglong_time(&ltime);
@@ -1420,7 +1420,7 @@ String *Item_func_now::val_str(String *str)
void Item_func_now::fix_length_and_dec()
{
- decimals=0;
+ decimals= DATETIME_DEC;
collation.set(&my_charset_bin);
store_now_in_TIME(&ltime);
@@ -1681,7 +1681,7 @@ void Item_func_from_unixtime::fix_length_and_dec()
{
thd= current_thd;
collation.set(&my_charset_bin);
- decimals=0;
+ decimals= DATETIME_DEC;
max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null= 1;
thd->time_zone_used= 1;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 163b1591e52..ac26455371d 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -580,6 +580,7 @@ public:
{
collation.set(&my_charset_bin);
maybe_null=1;
+ decimals= DATETIME_DEC;
max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
}
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }