Commit 910fe392 authored by unknown's avatar unknown

Merge naruto.:C:/cpp/bug21811/my50-bug21811

into  naruto.:C:/cpp/bug21811/my51-bug21811


mysql-test/r/func_time.result:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
parents 54886b08 5e71afcb
...@@ -71,3 +71,17 @@ NULL ...@@ -71,3 +71,17 @@ NULL
NULL NULL
NULL NULL
drop table t1; drop table t1;
End of 4.1 tests
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY
2006-09-27
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH
2006-10-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR
2007-09-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK
2006-10-03
End of 5.0 tests
...@@ -612,7 +612,7 @@ date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) ...@@ -612,7 +612,7 @@ date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
2003-01-03 01:01:01 2003-01-03 01:01:01
select date_add(date,INTERVAL "1" WEEK) from t1; select date_add(date,INTERVAL "1" WEEK) from t1;
date_add(date,INTERVAL "1" WEEK) date_add(date,INTERVAL "1" WEEK)
2003-01-09 00:00:00 2003-01-09
select date_add(date,INTERVAL "1" QUARTER) from t1; select date_add(date,INTERVAL "1" QUARTER) from t1;
date_add(date,INTERVAL "1" QUARTER) date_add(date,INTERVAL "1" QUARTER)
2003-04-02 2003-04-02
...@@ -621,7 +621,7 @@ timestampadd(MINUTE, 1, date) ...@@ -621,7 +621,7 @@ timestampadd(MINUTE, 1, date)
2003-01-02 00:01:00 2003-01-02 00:01:00
select timestampadd(WEEK, 1, date) from t1; select timestampadd(WEEK, 1, date) from t1;
timestampadd(WEEK, 1, date) timestampadd(WEEK, 1, date)
2003-01-09 00:00:00 2003-01-09
select timestampadd(SQL_TSI_SECOND, 1, date) from t1; select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_SECOND, 1, date) timestampadd(SQL_TSI_SECOND, 1, date)
2003-01-02 00:00:01 2003-01-02 00:00:01
......
...@@ -64,4 +64,17 @@ insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY)); ...@@ -64,4 +64,17 @@ insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
select * from t1; select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests --echo End of 4.1 tests
#
# Bug#21811
#
# Make sure we end up with an appropriate
# date format (DATE) after addition operation
#
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
--echo End of 5.0 tests
...@@ -2030,11 +2030,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const ...@@ -2030,11 +2030,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
(date_sub_interval == other->date_sub_interval)); (date_sub_interval == other->date_sub_interval));
} }
/*
'interval_names' reflects the order of the enumeration interval_type.
See item_timefunc.h
*/
static const char *interval_names[]= static const char *interval_names[]=
{ {
"year", "quarter", "month", "day", "hour", "year", "quarter", "month", "week", "day",
"minute", "week", "second", "microsecond", "hour", "minute", "second", "microsecond",
"year_month", "day_hour", "day_minute", "year_month", "day_hour", "day_minute",
"day_second", "hour_minute", "hour_second", "day_second", "hour_minute", "hour_second",
"minute_second", "day_microsecond", "minute_second", "day_microsecond",
......
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