From 431d0e610114110233b1cccc1f8a1d6d49951509 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 May 2004 15:59:29 +0500 Subject: [PATCH] Proposed fix for bug #3412 (embedded server: prepared statement returns empty recordset where some records should be found) sql/ha_myisam.cc: Code simplified with vio_ok() sql/mysqld.cc: vio_ok used sql/slave.cc: vio_ok used sql/sql_class.cc: Here is the place of the error - we should not examine net.vio in embedded library sql/sql_class.h: method added to always return TRUE in embedded library, and to sheck thd.net.vio otherwise sql/sql_show.cc: code simplified with vio_ok() --- sql/ha_myisam.cc | 4 +--- sql/mysqld.cc | 2 +- sql/slave.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 ++ sql/sql_show.cc | 7 +------ 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 3c7852c703a..318e0fbb507 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -60,13 +60,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, DBUG_PRINT(msg_type,("message: %s",msgbuf)); -#ifndef EMBEDDED_LIBRARY - if (thd->net.vio == 0) + if (!thd->vio_ok()) { sql_print_error(msgbuf); return; } -#endif if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR)) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fbe70705be3..d6ecbd990c1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -661,7 +661,7 @@ static void close_connections(void) break; } #ifndef __bsdi__ // Bug in BSDI kernel - if (tmp->net.vio) + if (tmp->vio_ok()) { sql_print_error(ER(ER_FORCING_CLOSE),my_progname, tmp->thread_id,tmp->user ? tmp->user : ""); diff --git a/sql/slave.cc b/sql/slave.cc index fa17a192b12..59af7c663e9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1386,7 +1386,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, thd->net.no_send_ok = 0; // Clear up garbage after create_table_from_dump if (!called_connected) mysql_close(mysql); - if (errmsg && thd->net.vio) + if (errmsg && thd->vio_ok()) send_error(thd, error, errmsg); DBUG_RETURN(test(error)); // Return 1 on error } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9d368db0229..d16d1de7607 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -746,7 +746,7 @@ bool select_send::send_data(List &items) } } thd->sent_row_count++; - if (!thd->net.vio) + if (!thd->vio_ok()) DBUG_RETURN(0); if (!thd->net.report_error) DBUG_RETURN(protocol->write()); diff --git a/sql/sql_class.h b/sql/sql_class.h index d787dcabd00..7c8533af285 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -932,8 +932,10 @@ public: net.last_errno= 0; net.report_error= 0; } + inline bool vio_ok() const { return net.vio; } #else void clear_error(); + inline bool vio_ok() const { return true; } #endif inline void fatal_error() { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a54a6fa1a4c..6c4b65a4a70 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1540,13 +1540,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) while ((tmp=it++)) { struct st_my_thread_var *mysys_var; -#ifndef EMBEDDED_LIBRARY - if ((tmp->net.vio || tmp->system_thread) && + if ((tmp->vio_ok() || tmp->system_thread) && (!user || (tmp->user && !strcmp(tmp->user,user)))) -#else - if (tmp->system_thread && - (!user || (tmp->user && !strcmp(tmp->user,user)))) -#endif { thread_info *thd_info=new thread_info;