diff options
author | unknown <monty@mysql.com> | 2004-02-11 00:06:46 +0100 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-02-11 00:06:46 +0100 |
commit | 5b2c3126277a8eedab5bcc8a9b0ce7386ccc3dbe (patch) | |
tree | 927515d304bd661aebdb0e534418caf49d322ada /sql/sql_rename.cc | |
parent | dc792940232f3265e21905cb939853f4db5ebd16 (diff) | |
parent | 65ec6a41b65f26552481be24ac8947c83eeea198 (diff) | |
download | mariadb-git-5b2c3126277a8eedab5bcc8a9b0ce7386ccc3dbe.tar.gz |
Merge with 4.0.18
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
mysql-test/r/ctype_tis620.result-old:
Merge rename: mysql-test/r/ctype_tis620.result -> mysql-test/r/ctype_tis620.result-old
BUILD/compile-pentium-max:
Auto merged
BitKeeper/etc/config:
Auto merged
Build-tools/Bootstrap:
Auto merged
Build-tools/Do-compile:
Auto merged
configure.in:
Auto merged
mysql-test/t/ctype_tis620.test-old:
Merge rename: mysql-test/t/ctype_tis620.test -> mysql-test/t/ctype_tis620.test-old
Docs/Makefile.am:
Auto merged
client/mysqldump.c:
Auto merged
client/mysqltest.c:
Auto merged
include/my_global.h:
Auto merged
include/my_pthread.h:
Auto merged
include/my_sys.h:
Auto merged
include/myisam.h:
Auto merged
innobase/btr/btr0cur.c:
Auto merged
innobase/ibuf/ibuf0ibuf.c:
Auto merged
innobase/include/dict0dict.h:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/include/ut0mem.h:
Auto merged
innobase/log/log0log.c:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0sel.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
innobase/ut/ut0mem.c:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/mi_dynrec.c:
Auto merged
myisam/mi_key.c:
Auto merged
myisam/myisam_ftdump.c:
Auto merged
myisam/myisamdef.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/alter_table.result:
Auto merged
mysql-test/r/bdb.result:
Auto merged
mysql-test/r/bigint.result:
Auto merged
mysql-test/r/fulltext.result:
Auto merged
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r-- | sql/sql_rename.cc | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 3ab6621f35b..6cff90ff613 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -112,19 +112,31 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error) { db_type table_type; char name[FN_REFLEN]; - new_table=ren_table->next; + const char *new_alias, *old_alias; + new_table=ren_table->next; + if (lower_case_table_names == 2) + { + old_alias= ren_table->alias; + new_alias= new_table->alias; + } + else + { + old_alias= ren_table->real_name; + new_alias= new_table->real_name; + } sprintf(name,"%s/%s/%s%s",mysql_data_home, - new_table->db,new_table->real_name, - reg_ext); + new_table->db, new_alias, reg_ext); + unpack_filename(name, name); if (!access(name,F_OK)) { - my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name); + my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_alias); DBUG_RETURN(ren_table); // This can't be skipped } sprintf(name,"%s/%s/%s%s",mysql_data_home, - ren_table->db,ren_table->real_name, + ren_table->db, old_alias, reg_ext); + unpack_filename(name, name); if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN) { my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno); @@ -132,8 +144,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error) DBUG_RETURN(ren_table); } else if (mysql_rename_table(table_type, - ren_table->db, ren_table->real_name, - new_table->db, new_table->real_name)) + ren_table->db, old_alias, + new_table->db, new_alias)) { if (!skip_error) DBUG_RETURN(ren_table); |