From feb8dc9ee5f114c2a4eb7756e92b7c4d9eedbf1c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Feb 2003 18:00:34 +0100 Subject: [PATCH] ALTER TABLE closes all open HANDLER's for the table in question fixed error handling in HANDLER ... READ FIRST sql/sql_handler.cc: fix error handling in HANDLER ... READ FIRST sql/sql_table.cc: ALTER TABLE closes all open HANDLER's for the table in question --- sql/sql_handler.cc | 11 +++++++---- sql/sql_table.cc | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 12e8c9e227a..a98b6c13a00 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -153,10 +153,13 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, { switch(mode) { case RFIRST: - err=keyname ? - table->file->index_first(table->record[0]) : - table->file->rnd_init(1) || - table->file->rnd_next(table->record[0]); + if (keyname) + err=table->file->index_first(table->record[0]); + else + { + if (!(err=table->file->rnd_init(1))) + err=table->file->rnd_next(table->record[0]); + } mode=RNEXT; break; case RLAST: diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 31fcb0be8e3..4c92c35632a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1374,6 +1374,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, new_db=db; used_fields=create_info->used_fields; + mysql_ha_closeall(thd, table_list); if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) DBUG_RETURN(-1);