diff options
author | unknown <bell@sanja.is.com.ua> | 2002-11-04 00:56:25 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2002-11-04 00:56:25 +0200 |
commit | a4e64e252d16a6b7a140ae14ae24fd9d92c558c3 (patch) | |
tree | 60db038618444a420a7e4f19b4b7fc4c7840b7bb | |
parent | 4358ac0c9f58ea8fa9e7fdb2374e81bdc144d93c (diff) | |
download | mariadb-git-a4e64e252d16a6b7a140ae14ae24fd9d92c558c3.tar.gz |
Fixed error handling bug
sql/sql_class.h:
new function for clean out error message
-rw-r--r-- | sql/log_event.cc | 6 | ||||
-rw-r--r-- | sql/mini_client.cc | 1 | ||||
-rw-r--r-- | sql/sql_base.cc | 11 | ||||
-rw-r--r-- | sql/sql_class.h | 6 | ||||
-rw-r--r-- | sql/sql_insert.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 |
6 files changed, 16 insertions, 13 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 014cdcb4961..c168c951c8f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -841,9 +841,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id = query_id++; VOID(pthread_mutex_unlock(&LOCK_thread_count)); - thd->query_error = 0; // clear error - thd->net.last_errno = 0; - thd->net.last_error[0] = 0; + thd->query_error= 0; // clear error + thd->clear_error(); + thd->slave_proxy_id = thread_id; // for temp tables /* diff --git a/sql/mini_client.cc b/sql/mini_client.cc index d678e76c5ed..aa84a52eb0b 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -451,6 +451,7 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command, mysql->net.last_error[0]=0; mysql->net.last_errno=0; + mysql->net.report_error=0; mysql->info=0; mysql->affected_rows= ~(my_ulonglong) 0; net_clear(net); /* Clear receive buffer */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d9818053e89..27848b141ac 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1464,9 +1464,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, } } pthread_mutex_unlock(&LOCK_open); - thd->net.last_error[0]=0; // Clear error message - thd->net.last_errno=0; - error=0; + thd->clear_error(); // Clear error message + error= 0; if (openfrm(path,alias, (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | HA_TRY_READ_ONLY), @@ -1476,8 +1475,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, (entry->file->is_crashed() && entry->file->check_and_repair(thd))) { /* Give right error message */ - thd->net.last_error[0]=0; - thd->net.last_errno=0; + thd->clear_error(); my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno); sql_print_error("Error: Couldn't repair table: %s.%s",db,name); if (entry->file) @@ -1486,8 +1484,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, } else { - thd->net.last_error[0]=0; // Clear error message - thd->net.last_errno=0; + thd->clear_error(); // Clear error message } pthread_mutex_lock(&LOCK_open); unlock_table_name(thd,&table_list); diff --git a/sql/sql_class.h b/sql/sql_class.h index d46826c928d..71f1625309f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -625,6 +625,12 @@ public: void add_changed_table(const char *key, long key_length); CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length); int send_explain_fields(select_result *result); + inline void clear_error() + { + net.last_error[0]= 0; + net.last_errno= 0; + net.report_error= 0; + } }; /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d15d9a407d6..0a1b4435fff 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1180,7 +1180,7 @@ bool delayed_insert::handle_inserts(void) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); using_ignore=1; } - thd.net.last_errno = 0; // reset error for binlog + thd.clear_error(); // reset error for binlog if (write_record(table,&info)) { info.error_count++; // Ignore errors diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 97714da0e8d..d193370eef7 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -857,8 +857,7 @@ bool do_command(THD *thd) old_timeout=net->read_timeout; // Wait max for 8 hours net->read_timeout=(uint) thd->variables.net_wait_timeout; - net->last_error[0]=0; // Clear error message - net->last_errno=0; + thd->clear_error(); // Clear error message net_new_transaction(net); if ((packet_length=my_net_read(net)) == packet_error) |