summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorvenu@myvenu.com <>2003-04-30 00:02:28 -0700
committervenu@myvenu.com <>2003-04-30 00:02:28 -0700
commiteb137c063c05b2511eed85f0027498d64a910e11 (patch)
treecabb1435029397264db6d20a3a7da3ab9fed3d00 /sql/field_conv.cc
parent23a522c026e531bfbef4935918db856b45bfff90 (diff)
downloadmariadb-git-eb137c063c05b2511eed85f0027498d64a910e11.tar.gz
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
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc13
1 files changed, 8 insertions, 5 deletions
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);