diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_myisam.cc | 6 | ||||
-rw-r--r-- | sql/sql_select.cc | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 1a205e54b9d..b6cfc2c3612 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -533,7 +533,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT, 4+ (param.opt_follow_links ? 16 : 0))); - if (mi_lock_database(file,F_WRLCK)) + // Don't lock tables if we have used LOCK TABLE + if (!thd->locked_tables && mi_lock_database(file,F_WRLCK)) { mi_check_print_error(¶m,ER(ER_CANT_LOCK),my_errno); DBUG_RETURN(HA_ADMIN_FAILED); @@ -615,7 +616,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) update_state_info(¶m, file, 0); } thd->proc_info=old_proc_info; - mi_lock_database(file,F_UNLCK); + if (!thd->locked_tables) + mi_lock_database(file,F_UNLCK); DBUG_RETURN(error ? HA_ADMIN_FAILED : !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e726a9969ca..77cf20f813a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -528,9 +528,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, if (order && (join.const_tables == join.tables || test_if_skip_sort_order(&join.join_tab[join.const_tables], order, - (having || group || - join.const_tables != join.tables - 1) ? - HA_POS_ERROR : thd->select_limit))) + (group ? HA_POS_ERROR : thd->select_limit)))) order=0; select_describe(&join,need_tmp, (order != 0 && |