summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/item_timefunc.cc4
-rw-r--r--sql/sql_time.cc4
4 files changed, 7 insertions, 8 deletions
diff --git a/sql/item.h b/sql/item.h
index 2d6cf68d818..5dd49d9c6b2 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1041,7 +1041,7 @@ public:
Item **ref, bool skip_registered);
virtual bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
bool get_time(MYSQL_TIME *ltime)
- { return get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE); }
+ { return get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE | TIME_INVALID_DATES); }
bool get_seconds(ulonglong *sec, ulong *sec_part);
virtual bool get_date_result(MYSQL_TIME *ltime, ulonglong fuzzydate)
{ return get_date(ltime,fuzzydate); }
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 3decf076f4f..6ea58dfd2c9 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4114,10 +4114,9 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
}
break;
case DYN_COL_DATETIME:
- args[valpos]->get_date(&vals[i].x.time_value, TIME_FUZZY_DATE);
- break;
case DYN_COL_DATE:
- args[valpos]->get_date(&vals[i].x.time_value, TIME_FUZZY_DATE);
+ args[valpos]->get_date(&vals[i].x.time_value,
+ TIME_FUZZY_DATE | sql_mode_for_dates());
break;
case DYN_COL_TIME:
args[valpos]->get_time(&vals[i].x.time_value);
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 011fd06211f..e9a6727162a 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2433,6 +2433,7 @@ bool Item_time_typecast::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
bool Item_date_typecast::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
+ fuzzy_date |= sql_mode_for_dates();
if (get_arg0_date(ltime, fuzzy_date & ~TIME_TIME_ONLY))
return 1;
@@ -2454,6 +2455,7 @@ bool Item_date_typecast::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
bool Item_datetime_typecast::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
+ fuzzy_date |= sql_mode_for_dates();
if (get_arg0_date(ltime, fuzzy_date & ~TIME_TIME_ONLY))
return 1;
@@ -3123,7 +3125,7 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
date_time_format.format.length= format->length();
if (extract_date_time(&date_time_format, val->ptr(), val->length(),
ltime, cached_timestamp_type, 0, "datetime",
- fuzzy_date))
+ fuzzy_date | sql_mode_for_dates()))
return (null_value=1);
if (cached_timestamp_type == MYSQL_TIMESTAMP_TIME && ltime->day)
{
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index e989ce6f3a0..6f15ada2dcd 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -295,9 +295,7 @@ str_to_datetime_with_warn(CHARSET_INFO *cs,
THD *thd= current_thd;
timestamp_type ts_type;
- ts_type= str_to_datetime(cs, str, length, l_time,
- (flags | (sql_mode_for_dates(thd))),
- &was_cut);
+ ts_type= str_to_datetime(cs, str, length, l_time, flags, &was_cut);
if (was_cut || ts_type <= MYSQL_TIMESTAMP_ERROR)
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
str, length, flags & TIME_TIME_ONLY ?