summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 71a9afd6a9d..a26f1eac5ba 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -544,6 +544,15 @@ Item::Item(THD *thd):
}
+const TABLE_SHARE *Item::field_table_or_null()
+{
+ if (real_item()->type() != Item::FIELD_ITEM)
+ return NULL;
+
+ return ((Item_field *) this)->field->table->s;
+}
+
+
/**
Constructor used by Item_field, Item_ref & aggregate (sum)
functions.
@@ -1450,6 +1459,7 @@ bool Item::get_date_from_int(MYSQL_TIME *ltime, ulonglong fuzzydate)
bool neg= !unsigned_flag && value < 0;
if (null_value || int_to_datetime_with_warn(neg, neg ? -value : value,
ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null()))
return null_value|= make_zero_date(ltime, fuzzydate);
return null_value= false;
@@ -1470,6 +1480,7 @@ bool Item::get_date_from_year(MYSQL_TIME *ltime, ulonglong fuzzydate)
value*= 10000; /* make it YYYYMMHH */
if (null_value || int_to_datetime_with_warn(false, value,
ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null()))
return null_value|= make_zero_date(ltime, fuzzydate);
return null_value= false;
@@ -1480,6 +1491,7 @@ bool Item::get_date_from_real(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
double value= val_real();
if (null_value || double_to_datetime_with_warn(value, ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null()))
return null_value|= make_zero_date(ltime, fuzzydate);
return null_value= false;
@@ -1491,6 +1503,7 @@ bool Item::get_date_from_decimal(MYSQL_TIME *ltime, ulonglong fuzzydate)
my_decimal value, *res;
if (!(res= val_decimal(&value)) ||
decimal_to_datetime_with_warn(res, ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null()))
return null_value|= make_zero_date(ltime, fuzzydate);
return null_value= false;
@@ -4286,7 +4299,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
{
ErrConvTime str(&value.time);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &str, time_type, 0);
+ &str, time_type, 0, 0);
set_zero_time(&value.time, time_type);
}
maybe_null= 0;