summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-08-29 17:55:59 +0200
committerSergei Golubchik <sergii@pisem.net>2012-08-29 17:55:59 +0200
commit3444e8e9254070f836488dae12b5c825cc9c563f (patch)
treead216f2ff4a45a1d6894e807f13ecdf40e3d4c5b /sql/item_timefunc.cc
parenta44331ab3407488368c9984258ce4c3160872816 (diff)
downloadmariadb-git-3444e8e9254070f836488dae12b5c825cc9c563f.tar.gz
MDEV-454 Addition of a time interval reduces the resulting value
1. Field_newdate::get_date should refuse to return a date with zeros when TIME_NO_ZERO_IN_DATE is set, not when TIME_FUZZY_DATE is unset 2. Item_func_to_days and Item_date_add_interval can only work with valid dates, no zeros allowed.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 2cd8b3215c4..bdad96f12ef 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -751,7 +751,7 @@ longlong Item_func_to_days::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return 0;
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
}
@@ -1932,7 +1932,7 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
{
INTERVAL interval;
- if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE) ||
+ if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE | TIME_NO_ZERO_IN_DATE) ||
get_interval_value(args[1], int_type, &value, &interval))
return (null_value=1);