diff options
author | unknown <malff@lambda.weblab> | 2007-09-10 16:10:37 -0600 |
---|---|---|
committer | unknown <malff@lambda.weblab> | 2007-09-10 16:10:37 -0600 |
commit | 8076d23f41d689c611ad320251bb6d295f0b405f (patch) | |
tree | 294fbdf2431b9ff5f06776f4ddad015a4272bdc1 /sql/sql_parse.cc | |
parent | 5a437ae911f434793538e0fa2a0f83ea1dc71bb7 (diff) | |
download | mariadb-git-8076d23f41d689c611ad320251bb6d295f0b405f.tar.gz |
WL#4030 (Deprecate RENAME DATABASE: replace with ALTER DATABASE <name>
UPGRADE)
Bug 17565 (RENAME DATABASE destroys events)
Bug#28360 (RENAME DATABASE destroys routines)
Removed the
RENAME DATABASE db1 TO db2
statement.
Implemented the
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
statement, which has the same function.
client/mysqlcheck.c:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/create.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/query_cache.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/renamedb.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/sp-code.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/sp-error.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/r/upgrade.result:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/t/create.test:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/t/query_cache.test:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/t/renamedb.test:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/t/sp-error.test:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
mysql-test/t/upgrade.test:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/mysql_priv.h:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/sql_lex.h:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/sql_parse.cc:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/sql_prepare.cc:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/sql_yacc.yy:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
sql/sql_db.cc:
ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bbd6cb16d11..6002d7545ba 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3175,12 +3175,9 @@ end_with_restore_list: res= mysql_rm_db(thd, lex->name.str, lex->drop_if_exists, 0); break; } - case SQLCOM_RENAME_DB: + case SQLCOM_ALTER_DB_UPGRADE: { - LEX_STRING *olddb, *newdb; - List_iterator <LEX_STRING> db_list(lex->db_list); - olddb= db_list++; - newdb= db_list++; + LEX_STRING *db= & lex->name; if (end_active_trans(thd)) { res= 1; @@ -3188,24 +3185,22 @@ end_with_restore_list: } #ifdef HAVE_REPLICATION if (thd->slave_thread && - (!rpl_filter->db_ok(olddb->str) || - !rpl_filter->db_ok(newdb->str) || - !rpl_filter->db_ok_with_wild_table(olddb->str) || - !rpl_filter->db_ok_with_wild_table(newdb->str))) + (!rpl_filter->db_ok(db->str) || + !rpl_filter->db_ok_with_wild_table(db->str))) { res= 1; my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0)); break; } #endif - if (check_db_name(newdb)) + if (check_db_name(db)) { - my_error(ER_WRONG_DB_NAME, MYF(0), newdb->str); + my_error(ER_WRONG_DB_NAME, MYF(0), db->str); break; } - if (check_access(thd,ALTER_ACL,olddb->str,0,1,0,is_schema_db(olddb->str)) || - check_access(thd,DROP_ACL,olddb->str,0,1,0,is_schema_db(olddb->str)) || - check_access(thd,CREATE_ACL,newdb->str,0,1,0,is_schema_db(newdb->str))) + if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) || + check_access(thd, DROP_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) || + check_access(thd, CREATE_ACL, db->str, 0, 1, 0, is_schema_db(db->str))) { res= 1; break; @@ -3217,7 +3212,8 @@ end_with_restore_list: ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); goto error; } - res= mysql_rename_db(thd, olddb, newdb); + + res= mysql_upgrade_db(thd, db); if (!res) send_ok(thd); break; |