From 5107f6b9b47e41c03d2c75f9d4d70b25dc0aab08 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 11 Feb 2010 19:41:53 +0200 Subject: [PATCH] Addendum to bug #46175 : use and check for the correct error values when converting to a enumerated type. --- sql/item.cc | 2 +- sql/sql_select.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index c967a1a0feb..df266434f72 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5157,7 +5157,7 @@ int Item::save_in_field(Field *field, bool no_conversions) field->set_notnull(); error=field->store(nr, unsigned_flag); } - return error ? error : (field->table->in_use->is_error() ? 2 : 0); + return error ? error : (field->table->in_use->is_error() ? 1 : 0); } diff --git a/sql/sql_select.h b/sql/sql_select.h index ef43f9b049c..8d3520bf9c8 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -736,10 +736,11 @@ public: we need to check for errors executing it and react accordingly */ if (!res && table->in_use->is_error()) - res= 2; + res= 1; /* STORE_KEY_FATAL */ dbug_tmp_restore_column_map(table->write_set, old_map); null_key= to_field->is_null() || item->null_value; - return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); + return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL : + (store_key_result) res); } }; @@ -775,10 +776,10 @@ protected: we need to check for errors executing it and react accordingly */ if (!err && to_field->table->in_use->is_error()) - err= 2; + err= 1; /* STORE_KEY_FATAL */ } null_key= to_field->is_null() || item->null_value; - return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); + return ((err < 0 || err > 2) ? STORE_KEY_FATAL : (store_key_result) err); } };