diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.cc | 9 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index ebae0d5e901..6e3f8486b45 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -121,8 +121,15 @@ handler *get_new_handler(TABLE *table, enum db_type db_type) #endif case DB_TYPE_HEAP: return new ha_heap(table); - case DB_TYPE_MYISAM: default: // should never happen + { + enum db_type def=(enum db_type) current_thd->variables.table_type; + /* Try first with 'default table type' */ + if (db_type != def) + return get_new_handler(table, def); + } + /* Fall back to MyISAM */ + case DB_TYPE_MYISAM: return new ha_myisam(table); case DB_TYPE_MRG_MYISAM: return new ha_myisammrg(table); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dde4b6c5c93..8439db0be6b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -499,7 +499,10 @@ check_connections(THD *thd) thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); /* Cut very long hostnames to avoid possible overflows */ if (thd->host) + { thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; + thd->host_or_ip= thd->host; + } if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 95197ecfc4b..23e5049636a 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1064,10 +1064,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) { if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1))) my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN, - "%s:%u", thd->host_or_ip, tmp->peer_port); + "%s:%u", tmp->host_or_ip, tmp->peer_port); } else - thd_info->host= thd->strdup(thd->host_or_ip); + thd_info->host= thd->strdup(tmp->host_or_ip); if ((thd_info->db=tmp->db)) // Safe test thd_info->db=thd->strdup(thd_info->db); thd_info->command=(int) tmp->command; |