Commit 431d0e61 authored by unknown's avatar unknown

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()
parent a153d35c
...@@ -60,13 +60,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, ...@@ -60,13 +60,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
DBUG_PRINT(msg_type,("message: %s",msgbuf)); DBUG_PRINT(msg_type,("message: %s",msgbuf));
#ifndef EMBEDDED_LIBRARY if (!thd->vio_ok())
if (thd->net.vio == 0)
{ {
sql_print_error(msgbuf); sql_print_error(msgbuf);
return; return;
} }
#endif
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
T_AUTO_REPAIR)) T_AUTO_REPAIR))
......
...@@ -661,7 +661,7 @@ static void close_connections(void) ...@@ -661,7 +661,7 @@ static void close_connections(void)
break; break;
} }
#ifndef __bsdi__ // Bug in BSDI kernel #ifndef __bsdi__ // Bug in BSDI kernel
if (tmp->net.vio) if (tmp->vio_ok())
{ {
sql_print_error(ER(ER_FORCING_CLOSE),my_progname, sql_print_error(ER(ER_FORCING_CLOSE),my_progname,
tmp->thread_id,tmp->user ? tmp->user : ""); tmp->thread_id,tmp->user ? tmp->user : "");
......
...@@ -1386,7 +1386,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, ...@@ -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 thd->net.no_send_ok = 0; // Clear up garbage after create_table_from_dump
if (!called_connected) if (!called_connected)
mysql_close(mysql); mysql_close(mysql);
if (errmsg && thd->net.vio) if (errmsg && thd->vio_ok())
send_error(thd, error, errmsg); send_error(thd, error, errmsg);
DBUG_RETURN(test(error)); // Return 1 on error DBUG_RETURN(test(error)); // Return 1 on error
} }
......
...@@ -746,7 +746,7 @@ bool select_send::send_data(List<Item> &items) ...@@ -746,7 +746,7 @@ bool select_send::send_data(List<Item> &items)
} }
} }
thd->sent_row_count++; thd->sent_row_count++;
if (!thd->net.vio) if (!thd->vio_ok())
DBUG_RETURN(0); DBUG_RETURN(0);
if (!thd->net.report_error) if (!thd->net.report_error)
DBUG_RETURN(protocol->write()); DBUG_RETURN(protocol->write());
......
...@@ -932,8 +932,10 @@ class THD :public ilink, ...@@ -932,8 +932,10 @@ class THD :public ilink,
net.last_errno= 0; net.last_errno= 0;
net.report_error= 0; net.report_error= 0;
} }
inline bool vio_ok() const { return net.vio; }
#else #else
void clear_error(); void clear_error();
inline bool vio_ok() const { return true; }
#endif #endif
inline void fatal_error() inline void fatal_error()
{ {
......
...@@ -1540,13 +1540,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -1540,13 +1540,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
while ((tmp=it++)) while ((tmp=it++))
{ {
struct st_my_thread_var *mysys_var; struct st_my_thread_var *mysys_var;
#ifndef EMBEDDED_LIBRARY if ((tmp->vio_ok() || tmp->system_thread) &&
if ((tmp->net.vio || tmp->system_thread) &&
(!user || (tmp->user && !strcmp(tmp->user,user))))
#else
if (tmp->system_thread &&
(!user || (tmp->user && !strcmp(tmp->user,user)))) (!user || (tmp->user && !strcmp(tmp->user,user))))
#endif
{ {
thread_info *thd_info=new thread_info; thread_info *thd_info=new thread_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment