summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2018-12-16 02:21:41 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2018-12-16 02:21:41 +0400
commitc4ab352b670618bb478138cfbf3ed195317b3ccb (patch)
tree3dc86ad7d504865798871ae869ab5bac40e804b2 /sql/item.cc
parent0a2edddbf4f4737863edf51970cbbaa91e72e11f (diff)
downloadmariadb-git-c4ab352b670618bb478138cfbf3ed195317b3ccb.tar.gz
MDEV-14576 Include full name of object in message about incorrect value for column.
The error message modified. Then the TABLE_SHARE::error_table_name() implementation taken from 10.3, to be used as a name of the table in this message.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 25fb9be22eb..1c0b6cc4043 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -500,6 +500,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.
@@ -1358,6 +1367,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
}
if (null_value || int_to_datetime_with_warn(neg, neg ? -value : value,
ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null()))
goto err;
return null_value= false;
@@ -1366,6 +1376,7 @@ bool Item::get_date(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()))
goto err;
return null_value= false;
@@ -1375,6 +1386,7 @@ bool Item::get_date(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()))
goto err;
return null_value= false;
@@ -3630,7 +3642,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;