summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-06-21 23:47:39 +0200
committerSergei Golubchik <serg@mariadb.org>2018-06-21 23:47:39 +0200
commitb942aa34c10ddfa3fe4977ae60afed5cbdc51083 (patch)
tree0a1a934ca7b728e3ffb81cd2f7c6a858524726d4 /sql/item.cc
parentfe3f9fa9183ea3d10397b6f7f4d422ae9bba00a4 (diff)
parentc09a8b5b36edb494e2bcc93074c06e26cd9f2b92 (diff)
downloadmariadb-git-b942aa34c10ddfa3fe4977ae60afed5cbdc51083.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 4bc6fe7e5bc..a501ff6fdc6 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1360,7 +1360,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
ltime, fuzzydate,
field_name_or_null()))
goto err;
- break;
+ return null_value= false;
}
case REAL_RESULT:
{
@@ -1368,7 +1368,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
if (null_value || double_to_datetime_with_warn(value, ltime, fuzzydate,
field_name_or_null()))
goto err;
- break;
+ return null_value= false;
}
case DECIMAL_RESULT:
{
@@ -1377,7 +1377,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
decimal_to_datetime_with_warn(res, ltime, fuzzydate,
field_name_or_null()))
goto err;
- break;
+ return null_value= false;
}
case STRING_RESULT:
{
@@ -1387,15 +1387,20 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
ltime, fuzzydate))
goto err;
- break;
+ return null_value= false;
}
default:
+ null_value= true;
DBUG_ASSERT(0);
}
- return null_value= 0;
-
err:
+ return null_value|= make_zero_date(ltime, fuzzydate);
+}
+
+
+bool Item::make_zero_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+{
/*
if the item was not null and convertion failed, we return a zero date
if allowed, otherwise - null.
@@ -1417,7 +1422,7 @@ err:
*/
ltime->time_type= MYSQL_TIMESTAMP_TIME;
}
- return null_value|= !(fuzzydate & TIME_FUZZY_DATES);
+ return !(fuzzydate & TIME_FUZZY_DATES);
}
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
@@ -3366,6 +3371,15 @@ my_decimal *Item_null::val_decimal(my_decimal *decimal_value)
}
+bool Item_null::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+{
+ // following assert is redundant, because fixed=1 assigned in constructor
+ DBUG_ASSERT(fixed == 1);
+ make_zero_date(ltime, fuzzydate);
+ return (null_value= true);
+}
+
+
Item *Item_null::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
return this;