From 05af39d59102c5b46f71ca4d3626feba2c3c777a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Apr 2003 00:02:28 -0700 Subject: Support of warnings for all DML statements (Insert, Update and Alter) Fix LOAD DATA INFILE warnings to have a better meanigful messages Fix to make the mysql command line to automatically show the warnings count for all basic commands --- sql/field_conv.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sql/field_conv.cc') diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 47996606638..ec2488f520a 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -121,7 +121,7 @@ set_field_to_null(Field *field) field->reset(); if (current_thd->count_cuted_fields) { - current_thd->cuted_fields++; // Increment error counter + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,ER_WARN_DATA_TRUNCATED); return 0; } if (!current_thd->no_errors) @@ -175,7 +175,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) return 0; // field is set in handler.cc if (current_thd->count_cuted_fields) { - current_thd->cuted_fields++; // Increment error counter + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,ER_WARN_NULL_TO_NOTNULL); return 0; } if (!current_thd->no_errors) @@ -225,7 +225,8 @@ static void do_copy_not_null(Copy_field *copy) { if (*copy->from_null_ptr & copy->from_bit) { - current_thd->cuted_fields++; + copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DATA_TRUNCATED); copy->to_field->reset(); } else @@ -324,7 +325,8 @@ static void do_cut_string(Copy_field *copy) { if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible { - current_thd->cuted_fields++; // Give a warning + copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DATA_TRUNCATED); break; } } @@ -344,7 +346,8 @@ static void do_varstring(Copy_field *copy) { length=copy->to_length-2; if (current_thd->count_cuted_fields) - current_thd->cuted_fields++; // Increment error counter + copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DATA_TRUNCATED); } int2store(copy->to_ptr,length); memcpy(copy->to_ptr+2, copy->from_ptr,length); -- cgit v1.2.1