diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-18 11:33:53 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-18 11:33:53 +0200 |
commit | b5763ecd01ca9155ecce7b2f06e8a8bfce050ff9 (patch) | |
tree | b0ce48cd6f43a11d7465312dfe14552a8e4f8e3b /sql/field.cc | |
parent | 375256bae71e3f20d4498990610842b2976b6187 (diff) | |
parent | 45531949ae115f2ba7b9450cc2386653483211ba (diff) | |
download | mariadb-git-b5763ecd01ca9155ecce7b2f06e8a8bfce050ff9.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 33 |
1 files changed, 25 insertions, 8 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())); } |