diff options
author | unknown <monty@mysql.com> | 2005-02-21 14:47:57 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-02-21 14:47:57 +0200 |
commit | 7f54e80d54004a6304a95dd645c2262c35bf0244 (patch) | |
tree | a17a3f036e3a27e1c193e1d849ad788042a32f8c /sql/sql_table.cc | |
parent | e373993d9a620ed15b335a3f271412758f3b23c3 (diff) | |
download | mariadb-git-7f54e80d54004a6304a95dd645c2262c35bf0244.tar.gz |
Review of new pushed code (XA & other)
Portability fixes and cleanups
Fixed setting of 'res' in mysql_execute_command()
sql/handler.cc:
delete_table() will not return error for not found files if one handler file was found and deleted
sql/handler.h:
Incremented MAX_HA so that ndb works again
Don't convert char pointer to (my_xid*) as we don't know if the address is aligned on 8
sql/log.cc:
Indentation fixes
Simplified loop to find next log
Fixed race condition in reset_logs that caused mix_innodb_myisam_binlog to fail
sql/log_event.cc:
Don't convert char pointer to (my_xid*) as we don't know if the address is aligned on 8
sql/sql_acl.cc:
Convert db name directly to avoid extra strmov
sql/sql_base.cc:
Added comment
Removed not needed code
sql/sql_db.cc:
Added comment
Remove not needed code
sql/sql_parse.cc:
Always call mysql_rm_db() with lower case db name
Ensure that 'res' is set correctly in mysql_execute_command()
(One don't have to set res if one calls my_error() and res should be = 0 for correct commands)
sql/sql_repl.cc:
Indentation fixes
use packet->ptr() instead of packet->c_ptr()
sql/sql_table.cc:
Join similar code when table didn't exist in engine
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2a2c50574db..7f89db4f651 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -218,7 +218,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, (void) unpack_filename(path,path); } if (drop_temporary || - (access(path,F_OK) && ha_create_table_from_engine(thd,db,alias,TRUE)) || + (access(path,F_OK) && + ha_create_table_from_engine(thd,db,alias,TRUE)) || (!drop_view && mysql_frm_type(path) != FRMTYPE_TABLE)) { if (if_exists) @@ -234,34 +235,28 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, db_type table_type= get_table_type(path); *(end=fn_ext(path))=0; // Remove extension for delete error=ha_delete_table(table_type, path); - if (error == ENOENT && if_exists) - error = 0; + if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists) + { + /* Warn that the table did not exist in engine */ + if (error == HA_ERR_NO_SUCH_TABLE) + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), + table->table_name); + error= 0; + } if (error == HA_ERR_ROW_IS_REFERENCED) { /* the table is referenced by a foreign key constraint */ foreign_key_error=1; } - if (!error || error == ENOENT) + if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) { + int new_error; /* Delete the table definition file */ strmov(end,reg_ext); - if (!(error=my_delete(path,MYF(MY_WME)))) + if (!(new_error=my_delete(path,MYF(MY_WME)))) some_tables_deleted=1; - } - if (error == HA_ERR_NO_SUCH_TABLE) - { - /* The table did not exist in engine */ - if (if_exists) - { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), - table->table_name); - error= 0; - } - /* Delete the table definition file */ - strmov(end,reg_ext); - if (!(my_delete(path,MYF(MY_WME)))) - some_tables_deleted=1; + error|= new_error; } } if (error) |