diff options
author | malff@lambda.weblab <> | 2007-09-10 16:10:37 -0600 |
---|---|---|
committer | malff@lambda.weblab <> | 2007-09-10 16:10:37 -0600 |
commit | 18300001c1dbbfddf9a0adcbaeea68956102bdd0 (patch) | |
tree | 294fbdf2431b9ff5f06776f4ddad015a4272bdc1 /client/mysqlcheck.c | |
parent | ab60d8ae924f22a883dba50beb7eda4e7d13f2b6 (diff) | |
download | mariadb-git-18300001c1dbbfddf9a0adcbaeea68956102bdd0.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.
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 316412d7df9..6d85e30c033 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -539,13 +539,13 @@ static int process_all_tables_in_db(char *database) -static int fix_object_name(const char *obj, const char *name) +static int fix_table_storage_name(const char *name) { char qbuf[100 + NAME_LEN*4]; int rc= 0; if (strncmp(name, "#mysql50#", 9)) return 1; - sprintf(qbuf, "RENAME %s `%s` TO `%s`", obj, name, name + 9); + sprintf(qbuf, "RENAME TABLE `%s` TO `%s`", name, name + 9); if (mysql_query(sock, qbuf)) { fprintf(stderr, "Failed to %s\n", qbuf); @@ -557,6 +557,23 @@ static int fix_object_name(const char *obj, const char *name) return rc; } +static int fix_database_storage_name(const char *name) +{ + char qbuf[100 + NAME_LEN*4]; + int rc= 0; + if (strncmp(name, "#mysql50#", 9)) + return 1; + sprintf(qbuf, "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME", name); + if (mysql_query(sock, qbuf)) + { + fprintf(stderr, "Failed to %s\n", qbuf); + fprintf(stderr, "Error: %s\n", mysql_error(sock)); + rc= 1; + } + if (verbose) + printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); + return rc; +} static int process_one_db(char *database) { @@ -565,7 +582,7 @@ static int process_one_db(char *database) int rc= 0; if (opt_fix_db_names && !strncmp(database,"#mysql50#", 9)) { - rc= fix_object_name("DATABASE", database); + rc= fix_database_storage_name(database); database+= 9; } if (rc || !opt_fix_table_names) @@ -620,7 +637,7 @@ static int handle_request_for_tables(char *tables, uint length) op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG"; break; case DO_UPGRADE: - return fix_object_name("TABLE", tables); + return fix_table_storage_name(tables); } if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) |