Loading .bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -1613,3 +1613,4 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj scripts/mysql_upgrade client/client_priv.h +2 −1 Original line number Diff line number Diff line Loading @@ -59,5 +59,6 @@ enum options_client OPT_MYSQL_PRESERVE_SCHEMA, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES }; client/mysqlcheck.c +68 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, opt_compress = 0, opt_databases = 0, opt_fast = 0, opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, tty_password = 0, opt_frm = 0; tty_password = 0, opt_frm = 0, opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0; static uint verbose = 0, opt_mysql_port=0; static my_string opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, Loading @@ -48,7 +49,7 @@ static char *shared_memory_base_name=0; static uint opt_protocol=0; static CHARSET_INFO *charset_info= &my_charset_latin1; enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE}; enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; static struct my_option my_long_options[] = { Loading Loading @@ -78,6 +79,9 @@ static struct my_option my_long_options[] = {"check-only-changed", 'C', "Check only tables that have changed since last check or haven't been closed properly.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"check-upgrade", 'g', "Check tables for version dependent changes.May be used with auto-repair to correct tables requiring version dependent updates.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", OPT_COMPRESS, "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading @@ -98,6 +102,12 @@ static struct my_option my_long_options[] = {"fast",'F', "Check only tables that haven't been closed properly.", (gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.", (gptr*) &opt_fix_db_names, (gptr*) &opt_fix_db_names, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.", (gptr*) &opt_fix_table_names, (gptr*) &opt_fix_table_names, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Continue even if we get an sql-error.", (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -171,6 +181,7 @@ static int process_all_databases(); static int process_databases(char **db_names); static int process_selected_tables(char *db, char **table_names, int tables); static int process_all_tables_in_db(char *database); static int process_one_db(char *database); static int use_db(char *database); static int handle_request_for_tables(char *tables, uint length); static int dbConnect(char *host, char *user,char *passwd); Loading Loading @@ -251,6 +262,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'o': what_to_do = DO_OPTIMIZE; break; case OPT_FIX_DB_NAMES: what_to_do= DO_UPGRADE; default_charset= (char*) "utf8"; opt_databases= 1; break; case OPT_FIX_TABLE_NAMES: what_to_do= DO_UPGRADE; default_charset= (char*) "utf8"; break; case 'p': if (argument) { Loading @@ -268,6 +288,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'r': what_to_do = DO_REPAIR; break; case 'g': what_to_do= DO_CHECK; opt_upgrade= 1; break; case 'W': #ifdef __WIN__ opt_protocol = MYSQL_PROTOCOL_PIPE; Loading Loading @@ -369,7 +393,7 @@ static int process_all_databases() } while ((row = mysql_fetch_row(tableres))) { if (process_all_tables_in_db(row[0])) if (process_one_db(row[0])) result = 1; } return result; Loading @@ -382,7 +406,7 @@ static int process_databases(char **db_names) int result = 0; for ( ; *db_names ; db_names++) { if (process_all_tables_in_db(*db_names)) if (process_one_db(*db_names)) result = 1; } return result; Loading Loading @@ -495,6 +519,43 @@ static int process_all_tables_in_db(char *database) } /* process_all_tables_in_db */ static int fix_object_name(const char *obj, 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); 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) { if (what_to_do == DO_UPGRADE) { int rc= 0; if (opt_fix_db_names && !strncmp(database,"#mysql50#", 9)) { rc= fix_object_name("DATABASE", database); database+= 9; } if (rc || !opt_fix_table_names) return rc; } return process_all_tables_in_db(database); } static int use_db(char *database) { if (mysql_get_server_version(sock) >= 50003 && Loading Loading @@ -525,6 +586,7 @@ static int handle_request_for_tables(char *tables, uint length) if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ if (opt_extended) end = strmov(end, " EXTENDED"); if (opt_check_only_changed) end = strmov(end, " CHANGED"); if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); break; case DO_REPAIR: op = "REPAIR"; Loading @@ -538,6 +600,8 @@ static int handle_request_for_tables(char *tables, uint length) case DO_OPTIMIZE: op = "OPTIMIZE"; break; case DO_UPGRADE: return fix_object_name("TABLE", tables); } if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) Loading include/my_base.h +2 −2 Original line number Diff line number Diff line Loading @@ -370,9 +370,9 @@ enum ha_base_keytype { #define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints would lead to a duplicate key error in some other table. */ #define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */ #define HA_ERR_LAST 163 /* Copy last error no */ #define HA_ERR_LAST 164 /*Copy last error nr.*/ /* Add error numbers before HA_ERR_LAST and change it accordingly. */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) Loading include/myisam.h +1 −0 Original line number Diff line number Diff line Loading @@ -371,6 +371,7 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def); */ #define TT_USEFRM 1 #define TT_FOR_UPGRADE 2 #define O_NEW_INDEX 1 /* Bits set in out_flag */ #define O_NEW_DATA 2 Loading Loading
.bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -1613,3 +1613,4 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj scripts/mysql_upgrade
client/client_priv.h +2 −1 Original line number Diff line number Diff line Loading @@ -59,5 +59,6 @@ enum options_client OPT_MYSQL_PRESERVE_SCHEMA, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES };
client/mysqlcheck.c +68 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, opt_compress = 0, opt_databases = 0, opt_fast = 0, opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, tty_password = 0, opt_frm = 0; tty_password = 0, opt_frm = 0, opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0; static uint verbose = 0, opt_mysql_port=0; static my_string opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, Loading @@ -48,7 +49,7 @@ static char *shared_memory_base_name=0; static uint opt_protocol=0; static CHARSET_INFO *charset_info= &my_charset_latin1; enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE}; enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; static struct my_option my_long_options[] = { Loading Loading @@ -78,6 +79,9 @@ static struct my_option my_long_options[] = {"check-only-changed", 'C', "Check only tables that have changed since last check or haven't been closed properly.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"check-upgrade", 'g', "Check tables for version dependent changes.May be used with auto-repair to correct tables requiring version dependent updates.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", OPT_COMPRESS, "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading @@ -98,6 +102,12 @@ static struct my_option my_long_options[] = {"fast",'F', "Check only tables that haven't been closed properly.", (gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.", (gptr*) &opt_fix_db_names, (gptr*) &opt_fix_db_names, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.", (gptr*) &opt_fix_table_names, (gptr*) &opt_fix_table_names, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Continue even if we get an sql-error.", (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -171,6 +181,7 @@ static int process_all_databases(); static int process_databases(char **db_names); static int process_selected_tables(char *db, char **table_names, int tables); static int process_all_tables_in_db(char *database); static int process_one_db(char *database); static int use_db(char *database); static int handle_request_for_tables(char *tables, uint length); static int dbConnect(char *host, char *user,char *passwd); Loading Loading @@ -251,6 +262,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'o': what_to_do = DO_OPTIMIZE; break; case OPT_FIX_DB_NAMES: what_to_do= DO_UPGRADE; default_charset= (char*) "utf8"; opt_databases= 1; break; case OPT_FIX_TABLE_NAMES: what_to_do= DO_UPGRADE; default_charset= (char*) "utf8"; break; case 'p': if (argument) { Loading @@ -268,6 +288,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'r': what_to_do = DO_REPAIR; break; case 'g': what_to_do= DO_CHECK; opt_upgrade= 1; break; case 'W': #ifdef __WIN__ opt_protocol = MYSQL_PROTOCOL_PIPE; Loading Loading @@ -369,7 +393,7 @@ static int process_all_databases() } while ((row = mysql_fetch_row(tableres))) { if (process_all_tables_in_db(row[0])) if (process_one_db(row[0])) result = 1; } return result; Loading @@ -382,7 +406,7 @@ static int process_databases(char **db_names) int result = 0; for ( ; *db_names ; db_names++) { if (process_all_tables_in_db(*db_names)) if (process_one_db(*db_names)) result = 1; } return result; Loading Loading @@ -495,6 +519,43 @@ static int process_all_tables_in_db(char *database) } /* process_all_tables_in_db */ static int fix_object_name(const char *obj, 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); 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) { if (what_to_do == DO_UPGRADE) { int rc= 0; if (opt_fix_db_names && !strncmp(database,"#mysql50#", 9)) { rc= fix_object_name("DATABASE", database); database+= 9; } if (rc || !opt_fix_table_names) return rc; } return process_all_tables_in_db(database); } static int use_db(char *database) { if (mysql_get_server_version(sock) >= 50003 && Loading Loading @@ -525,6 +586,7 @@ static int handle_request_for_tables(char *tables, uint length) if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ if (opt_extended) end = strmov(end, " EXTENDED"); if (opt_check_only_changed) end = strmov(end, " CHANGED"); if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); break; case DO_REPAIR: op = "REPAIR"; Loading @@ -538,6 +600,8 @@ static int handle_request_for_tables(char *tables, uint length) case DO_OPTIMIZE: op = "OPTIMIZE"; break; case DO_UPGRADE: return fix_object_name("TABLE", tables); } if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) Loading
include/my_base.h +2 −2 Original line number Diff line number Diff line Loading @@ -370,9 +370,9 @@ enum ha_base_keytype { #define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints would lead to a duplicate key error in some other table. */ #define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */ #define HA_ERR_LAST 163 /* Copy last error no */ #define HA_ERR_LAST 164 /*Copy last error nr.*/ /* Add error numbers before HA_ERR_LAST and change it accordingly. */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) Loading
include/myisam.h +1 −0 Original line number Diff line number Diff line Loading @@ -371,6 +371,7 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def); */ #define TT_USEFRM 1 #define TT_FOR_UPGRADE 2 #define O_NEW_INDEX 1 /* Bits set in out_flag */ #define O_NEW_DATA 2 Loading