diff options
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fc7ea6a2794..abb3cf666b0 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1703,15 +1703,19 @@ Statement_map::Statement_map() : int Statement_map::insert(Statement *statement) { - int rc= my_hash_insert(&st_hash, (byte *) statement); + int res= my_hash_insert(&st_hash, (byte *) statement); + if (res) + return res; if (statement->name.str) { - if ((rc= my_hash_insert(&names_hash, (byte*)statement))) + if ((res= my_hash_insert(&names_hash, (byte*)statement))) + { hash_delete(&st_hash, (byte*)statement); + return res; + } } - if (rc == 0) - last_found_statement= statement; - return rc; + last_found_statement= statement; + return res; } |