diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 33 | ||||
-rw-r--r-- | sql/field.h | 2 | ||||
-rw-r--r-- | sql/item.cc | 16 | ||||
-rw-r--r-- | sql/item.h | 4 | ||||
-rw-r--r-- | sql/item_func.h | 3 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 6 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 | ||||
-rw-r--r-- | sql/share/errmsg-utf8.txt | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 9 | ||||
-rw-r--r-- | sql/sql_class.h | 17 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 21 | ||||
-rw-r--r-- | sql/sql_time.cc | 27 | ||||
-rw-r--r-- | sql/sql_time.h | 7 | ||||
-rw-r--r-- | sql/sql_type.cc | 17 | ||||
-rw-r--r-- | sql/sql_type.h | 17 |
16 files changed, 127 insertions, 60 deletions
diff --git a/sql/field.cc b/sql/field.cc index 1786c835bcd..dd125a06bad 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2069,7 +2069,7 @@ bool Field_int::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate) ASSERT_COLUMN_MARKED_FOR_READ; Longlong_hybrid nr(val_int(), (flags & UNSIGNED_FLAG)); return int_to_datetime_with_warn(get_thd(), nr, ltime, - fuzzydate, field_name.str); + fuzzydate, table->s, field_name.str); } @@ -2256,7 +2256,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) bool Field::get_date(MYSQL_TIME *to, date_mode_t mode) { StringBuffer<40> tmp; - Temporal::Warn_push warn(get_thd(), NullS, to, mode); + Temporal::Warn_push warn(get_thd(), NULL, NullS, to, mode); Temporal_hybrid *t= new(to) Temporal_hybrid(get_thd(), &warn, val_str(&tmp), mode); return !t->is_valid_temporal(); @@ -4832,7 +4832,7 @@ bool Field_real::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate) ASSERT_COLUMN_MARKED_FOR_READ; double nr= val_real(); return double_to_datetime_with_warn(get_thd(), nr, ltime, fuzzydate, - field_name.str); + table->s, field_name.str); } @@ -6318,8 +6318,8 @@ bool Field_year::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate) if (tmp || field_length != 4) tmp+= 1900; return int_to_datetime_with_warn(get_thd(), - Longlong_hybrid(tmp * 10000, true), - ltime, fuzzydate, field_name.str); + Longlong_hybrid(tmp * 10000, true), + ltime, fuzzydate, table->s, field_name.str); } @@ -8919,10 +8919,18 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs) geom_type != Field::GEOM_GEOMETRYCOLLECTION && (uint32) geom_type != wkb_type) { + const char *db= table->s->db.str; + const char *tab_name= table->s->error_table_name(); + + if (!db) + db= ""; + if (!tab_name) + tab_name= ""; + my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0), Geometry::ci_collection[geom_type]->m_name.str, Geometry::ci_collection[wkb_type]->m_name.str, - field_name.str, + db, tab_name, field_name.str, (ulong) table->in_use->get_stmt_da()-> current_row_for_warning()); goto err_exit; @@ -10917,7 +10925,8 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level, THD *thd= get_thd(); if (thd->really_abort_on_warning() && level >= Sql_condition::WARN_LEVEL_WARN) thd->push_warning_truncated_value_for_field(level, typestr, - str->ptr(), field_name.str); + str->ptr(), table->s, + field_name.str); else set_warning(level, code, cuted_increment); } @@ -10927,10 +10936,18 @@ void Field::set_warning_truncated_wrong_value(const char *type_arg, const char *value) { THD *thd= get_thd(); + const char *db_name= table->s->db.str; + const char *table_name= table->s->error_table_name(); + + if (!db_name) + db_name= ""; + if (!table_name) + table_name= ""; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - type_arg, value, field_name.str, + type_arg, value, db_name, table_name, field_name.str, static_cast<ulong>(thd->get_stmt_da()-> current_row_for_warning())); } diff --git a/sql/field.h b/sql/field.h index f18ed9506f3..e762e45c024 100644 --- a/sql/field.h +++ b/sql/field.h @@ -2100,7 +2100,7 @@ public: { my_decimal nr(ptr, precision, dec); return decimal_to_datetime_with_warn(get_thd(), &nr, ltime, - fuzzydate, field_name.str); + fuzzydate, table->s, field_name.str); } bool val_bool() { diff --git a/sql/item.cc b/sql/item.cc index 6657d6cb7cb..ed9c78e5525 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -374,6 +374,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. @@ -1279,6 +1288,7 @@ bool Item::get_date_from_int(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) Longlong_hybrid value(val_int(), unsigned_flag); return null_value || int_to_datetime_with_warn(thd, value, ltime, fuzzydate, + field_table_or_null(), field_name_or_null()); } @@ -1288,6 +1298,7 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate double value= val_real(); return null_value || double_to_datetime_with_warn(thd, value, ltime, fuzzydate, + field_table_or_null(), field_name_or_null()); } @@ -1295,7 +1306,8 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate bool Item::get_date_from_string(THD *thd, MYSQL_TIME *to, date_mode_t mode) { StringBuffer<40> tmp; - Temporal::Warn_push warn(thd, field_name_or_null(), to, mode); + Temporal::Warn_push warn(thd, field_table_or_null(), field_name_or_null(), + to, mode); Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, val_str(&tmp), mode); return !t->is_valid_temporal(); } @@ -3989,7 +4001,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; diff --git a/sql/item.h b/sql/item.h index 9c53f731f6e..4f73230bfdd 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1501,6 +1501,7 @@ public: virtual const char *full_name() const { return name.str ? name.str : "???"; } const char *field_name_or_null() { return real_item()->type() == Item::FIELD_ITEM ? name.str : NULL; } + const TABLE_SHARE *field_table_or_null(); /* *result* family of methods is analog of *val* family (see above) but @@ -6802,7 +6803,8 @@ public: my_decimal *val_decimal(my_decimal *); bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) { - return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL); + return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, + NULL, NULL); } bool cache_value(); Item *convert_to_basic_const_item(THD *thd); diff --git a/sql/item_func.h b/sql/item_func.h index 36589bf2b2e..1081f2919c8 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1195,7 +1195,8 @@ public: my_decimal *val_decimal(my_decimal*); bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) { - return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL); + return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, + NULL, NULL); } const Type_handler *type_handler() const { return &type_handler_newdecimal; } void fix_length_and_dec_generic() {} diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 6f2af72dabf..8cc539f3d12 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -5135,7 +5135,7 @@ bool Item_dyncol_get::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat { longlong llval = (longlong)val.x.ulong_value; if (int_to_datetime_with_warn(thd, Longlong_hybrid(llval, !signed_value), - ltime, fuzzydate, 0 /* TODO */)) + ltime, fuzzydate, 0, 0 /* TODO */)) goto null; return 0; } @@ -5144,12 +5144,12 @@ bool Item_dyncol_get::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat /* fall through */ case DYN_COL_DOUBLE: if (double_to_datetime_with_warn(thd, val.x.double_value, ltime, fuzzydate, - 0 /* TODO */)) + 0, 0 /* TODO */)) goto null; return 0; case DYN_COL_DECIMAL: if (decimal_to_datetime_with_warn(thd, (my_decimal*)&val.x.decimal.value, - ltime, fuzzydate, 0 /* TODO */)) + ltime, fuzzydate, 0, 0 /* TODO */)) goto null; return 0; case DYN_COL_STRING: diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 4b072e253c5..cccb5a4b37f 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -453,7 +453,7 @@ static bool extract_date_time(THD *thd, DATE_TIME_FORMAT *format, { ErrConvString err(val_begin, length, &my_charset_bin); make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN, - &err, cached_timestamp_type, NullS); + &err, cached_timestamp_type, 0, NullS); break; } } while (++val != val_end); diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 02b06c95453..daf010d8e8a 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5449,8 +5449,8 @@ ER_DIVISION_BY_ZERO 22012 ger "Division durch 0" hindi "0 से विभाजन" ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 22007 - eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu" - ger "Falscher %-.32s-Wert: '%-.128s' für Feld '%.192s' in Zeile %lu" + eng "Incorrect %-.32s value: '%-.128s' for column `%.192s`.`%.192s`.`%.192s` at row %lu" + ger "Falscher %-.32s-Wert: '%-.128s' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu" ER_ILLEGAL_VALUE_FOR_TYPE 22007 eng "Illegal %s '%-.192s' value found during parsing" ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden" diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 15054b127e3..2292587bbd0 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3250,6 +3250,10 @@ int select_export::send_data(List<Item> &items) error_pos= copier.most_important_error_pos(); if (unlikely(error_pos)) { + /* + TODO: + add new error message that will show user this printable_buff + char printable_buff[32]; convert_to_printable(printable_buff, sizeof(printable_buff), error_pos, res->ptr() + res->length() - error_pos, @@ -3259,6 +3263,11 @@ int select_export::send_data(List<Item> &items) ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), "string", printable_buff, item->name.str, static_cast<long>(row_count)); + */ + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, + ER_THD(thd, WARN_DATA_TRUNCATED), + item->name.str, static_cast<long>(row_count)); } else if (copier.source_end_pos() < res->ptr() + res->length()) { diff --git a/sql/sql_class.h b/sql/sql_class.h index 49d34e3bdca..b1da6e19247 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4419,14 +4419,23 @@ public: } void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level level, const char *type_str, - const char *val, const char *name) + const char *val, + const TABLE_SHARE *s, + const char *name) { DBUG_ASSERT(name); char buff[MYSQL_ERRMSG_SIZE]; CHARSET_INFO *cs= &my_charset_latin1; + const char *db_name= s ? s->db.str : NULL; + const char *table_name= s ? s->error_table_name() : NULL; + + if (!db_name) + db_name= ""; + if (!table_name) + table_name= ""; cs->cset->snprintf(cs, buff, sizeof(buff), ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - type_str, val, name, + type_str, val, db_name, table_name, name, (ulong) get_stmt_da()->current_row_for_warning()); push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff); @@ -4435,10 +4444,12 @@ public: bool totally_useless_value, const char *type_str, const char *val, + const TABLE_SHARE *s, const char *field_name) { if (field_name) - push_warning_truncated_value_for_field(level, type_str, val, field_name); + push_warning_truncated_value_for_field(level, type_str, val, + s, field_name); else if (totally_useless_value) push_warning_wrong_value(level, type_str, val); else diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4b15cba1597..04baf5737c6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -22771,9 +22771,11 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, } file->extra(HA_EXTRA_NO_CACHE); + (void) file->ha_rnd_end(); DBUG_RETURN(0); err: file->extra(HA_EXTRA_NO_CACHE); + (void) file->ha_rnd_end(); if (error) file->print_error(error,MYF(0)); DBUG_RETURN(1); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5064fbcf70c..666c6fb325a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10075,16 +10075,6 @@ end_temporary: err_new_table_cleanup: my_free(const_cast<uchar*>(frm.str)); - if (new_table) - { - thd->drop_temporary_table(new_table, NULL, true); - } - else - (void) quick_rm_table(thd, new_db_type, - &alter_ctx.new_db, &alter_ctx.tmp_name, - (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)), - alter_ctx.get_tmp_path()); - /* No default value was provided for a DATE/DATETIME field, the current sql_mode doesn't allow the '0000-00-00' value and @@ -10114,11 +10104,22 @@ err_new_table_cleanup: thd->abort_on_warning= true; thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN, f_type, f_val, + new_table->s, alter_ctx.datetime_field-> field_name.str); thd->abort_on_warning= save_abort_on_warning; } + if (new_table) + { + thd->drop_temporary_table(new_table, NULL, true); + } + else + (void) quick_rm_table(thd, new_db_type, + &alter_ctx.new_db, &alter_ctx.tmp_name, + (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)), + alter_ctx.get_tmp_path()); + DBUG_RETURN(true); err_with_mdl_after_alter: diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 3977df675b3..fea23020d7e 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -297,7 +297,7 @@ check_date_with_warn(THD *thd, const MYSQL_TIME *ltime, { ErrConvTime str(ltime); make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN, - &str, ts_type, 0); + &str, ts_type, 0, 0); return true; } return false; @@ -431,16 +431,17 @@ str_to_datetime_with_warn(THD *thd, CHARSET_INFO *cs, const char *str, size_t length, MYSQL_TIME *to, date_mode_t mode) { - Temporal::Warn_push warn(thd, NullS, to, mode); + Temporal::Warn_push warn(thd, NULL, NullS, to, mode); Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, str, length, cs, mode); return !t->is_valid_temporal(); } bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime, - date_mode_t fuzzydate, const char *field_name) + date_mode_t fuzzydate, + const TABLE_SHARE *s, const char *field_name) { - Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate); + Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate); Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, value, fuzzydate); return !t->is_valid_temporal(); } @@ -448,9 +449,10 @@ bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime, bool decimal_to_datetime_with_warn(THD *thd, const my_decimal *value, MYSQL_TIME *ltime, - date_mode_t fuzzydate, const char *field_name) + date_mode_t fuzzydate, + const TABLE_SHARE *s, const char *field_name) { - Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate); + Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate); Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, value, fuzzydate); return !t->is_valid_temporal(); } @@ -458,13 +460,14 @@ bool decimal_to_datetime_with_warn(THD *thd, const my_decimal *value, bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr, MYSQL_TIME *ltime, - date_mode_t fuzzydate, const char *field_name) + date_mode_t fuzzydate, + const TABLE_SHARE *s, const char *field_name) { /* Note: conversion from an integer to TIME can overflow to '838:59:59.999999', so the conversion result can have fractional digits. */ - Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate); + Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate); Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, nr, fuzzydate); return !t->is_valid_temporal(); } @@ -894,12 +897,12 @@ void make_truncated_value_warning(THD *thd, Sql_condition::enum_warning_level level, const ErrConv *sval, timestamp_type time_type, - const char *field_name) + const TABLE_SHARE *s, const char *field_name) { const char *type_str= Temporal::type_name_by_timestamp_type(time_type); - return thd->push_warning_wrong_or_truncated_value(level, - time_type <= MYSQL_TIMESTAMP_ERROR, - type_str, sval->ptr(), field_name); + return thd->push_warning_wrong_or_truncated_value + (level, time_type <= MYSQL_TIMESTAMP_ERROR, type_str, sval->ptr(), + s, field_name); } diff --git a/sql/sql_time.h b/sql/sql_time.h index cfbff205667..161d08c80b8 100644 --- a/sql/sql_time.h +++ b/sql/sql_time.h @@ -44,15 +44,15 @@ bool str_to_datetime_with_warn(THD *thd, date_mode_t flags); bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime, date_mode_t fuzzydate, - const char *name); + const TABLE_SHARE *s, const char *name); bool decimal_to_datetime_with_warn(THD *thd, const my_decimal *value, MYSQL_TIME *ltime, date_mode_t fuzzydate, - const char *name); + const TABLE_SHARE *s, const char *name); bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr, MYSQL_TIME *ltime, date_mode_t fuzzydate, - const char *name); + const TABLE_SHARE *s, const char *name); bool time_to_datetime(THD *thd, const MYSQL_TIME *tm, MYSQL_TIME *dt); bool time_to_datetime_with_warn(THD *thd, @@ -78,6 +78,7 @@ void make_truncated_value_warning(THD *thd, Sql_condition::enum_warning_level level, const ErrConv *str_val, timestamp_type time_type, + const TABLE_SHARE *s, const char *field_name); extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type, diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 576601bb5fa..263b5198588 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -365,18 +365,21 @@ bool Sec6::convert_to_mysql_time(THD *thd, int *warn, MYSQL_TIME *ltime, } -void Temporal::push_conversion_warnings(THD *thd, bool totally_useless_value, int warn, +void Temporal::push_conversion_warnings(THD *thd, bool totally_useless_value, + int warn, const char *typestr, + const TABLE_SHARE *s, const char *field_name, const char *value) { if (MYSQL_TIME_WARN_HAVE_WARNINGS(warn)) thd->push_warning_wrong_or_truncated_value(Sql_condition::WARN_LEVEL_WARN, totally_useless_value, - typestr, value, field_name); + typestr, value, s, field_name); else if (MYSQL_TIME_WARN_HAVE_NOTES(warn)) thd->push_warning_wrong_or_truncated_value(Sql_condition::WARN_LEVEL_NOTE, - false, typestr, value, field_name); + false, typestr, value, s, + field_name); } @@ -4389,7 +4392,8 @@ bool Type_handler::Item_get_date_with_warn(THD *thd, Item *item, MYSQL_TIME *ltime, date_mode_t fuzzydate) const { - Temporal::Warn_push warn(thd, item->field_name_or_null(), ltime, fuzzydate); + Temporal::Warn_push warn(thd, item->field_table_or_null(), + item->field_name_or_null(), ltime, fuzzydate); Item_get_date(thd, item, &warn, ltime, fuzzydate); return ltime->time_type < 0; } @@ -4400,7 +4404,8 @@ bool Type_handler::Item_func_hybrid_field_type_get_date_with_warn(THD *thd, MYSQL_TIME *ltime, date_mode_t mode) const { - Temporal::Warn_push warn(thd, item->field_name_or_null(), ltime, mode); + Temporal::Warn_push warn(thd, item->field_table_or_null(), + item->field_name_or_null(), ltime, mode); Item_func_hybrid_field_type_get_date(thd, item, &warn, ltime, mode); return ltime->time_type < 0; } @@ -8010,7 +8015,7 @@ static void literal_warn(THD *thd, const Item *item, ErrConvString err(str, length, cs); thd->push_warning_wrong_or_truncated_value( Sql_condition::time_warn_level(st->warnings), - false, typestr, err.ptr(), NullS); + false, typestr, err.ptr(), NULL, NullS); } } else if (send_error) diff --git a/sql/sql_type.h b/sql/sql_type.h index 8a037d4f29d..5f53c5f4aae 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -613,34 +613,36 @@ public: public Status { public: - void push_conversion_warnings(THD *thd, bool totally_useless_value, date_mode_t mode, - timestamp_type tstype, const char *name) + void push_conversion_warnings(THD *thd, bool totally_useless_value, + date_mode_t mode, timestamp_type tstype, + const TABLE_SHARE* s, const char *name) { const char *typestr= tstype >= 0 ? type_name_by_timestamp_type(tstype) : mode & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY) ? "interval" : mode & TIME_TIME_ONLY ? "time" : "datetime"; - Temporal::push_conversion_warnings(thd, totally_useless_value, warnings, typestr, - name, ptr()); + Temporal::push_conversion_warnings(thd, totally_useless_value, warnings, + typestr, s, name, ptr()); } }; class Warn_push: public Warn { THD *m_thd; + const TABLE_SHARE *m_s; const char *m_name; const MYSQL_TIME *m_ltime; date_mode_t m_mode; public: - Warn_push(THD *thd, const char *name, + Warn_push(THD *thd, const TABLE_SHARE *s, const char *name, const MYSQL_TIME *ltime, date_mode_t mode) - :m_thd(thd), m_name(name), m_ltime(ltime), m_mode(mode) + :m_thd(thd), m_s(s), m_name(name), m_ltime(ltime), m_mode(mode) { } ~Warn_push() { if (warnings) push_conversion_warnings(m_thd, m_ltime->time_type < 0, - m_mode, m_ltime->time_type, m_name); + m_mode, m_ltime->time_type, m_s, m_name); } }; @@ -681,6 +683,7 @@ public: } static void push_conversion_warnings(THD *thd, bool totally_useless_value, int warn, const char *type_name, + const TABLE_SHARE *s, const char *field_name, const char *value); /* |