diff options
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 5a1dffd4014..10f787d5e20 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -18,7 +18,7 @@ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */ -#define CHECK_VERSION "2.7.2-MariaDB" +#define CHECK_VERSION "2.7.3-MariaDB" #include "client_priv.h" #include <m_ctype.h> @@ -196,8 +196,8 @@ static struct my_option my_long_options[] = {"user", 'u', "User for login if not current user.", ¤t_user, ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"verbose", 'v', "Print info about the various stages.", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Print info about the various stages; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} @@ -632,8 +632,10 @@ static int process_all_tables_in_db(char *database) } /* process_all_tables_in_db */ -static int run_query(const char *query) +static int run_query(const char *query, my_bool log_query) { + if (verbose >=3 && log_query) + puts(query); if (mysql_query(sock, query)) { fprintf(stderr, "Failed to %s\n", query); @@ -653,7 +655,7 @@ static int fix_table_storage_name(const char *name) if (strncmp(name, "#mysql50#", 9)) DBUG_RETURN(1); sprintf(qbuf, "RENAME TABLE `%s` TO `%s`", name, name + 9); - rc= run_query(qbuf); + rc= run_query(qbuf, 1); if (verbose) printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); DBUG_RETURN(rc); @@ -668,7 +670,7 @@ static int fix_database_storage_name(const char *name) if (strncmp(name, "#mysql50#", 9)) DBUG_RETURN(1); sprintf(qbuf, "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME", name); - rc= run_query(qbuf); + rc= run_query(qbuf, 1); if (verbose) printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); DBUG_RETURN(rc); @@ -687,6 +689,8 @@ static int rebuild_table(char *name) ptr= strmov(query, "ALTER TABLE "); ptr= fix_table_name(ptr, name); ptr= strxmov(ptr, " FORCE", NullS); + if (verbose >= 3) + puts(query); if (mysql_real_query(sock, query, (uint)(ptr - query))) { fprintf(stderr, "Failed to %s\n", query); @@ -750,7 +754,7 @@ static int disable_binlog() #else const char *stmt= "SET SQL_LOG_BIN=0"; #endif /* WITH_WSREP */ - return run_query(stmt); + return run_query(stmt, 0); } static int handle_request_for_tables(char *tables, uint length) @@ -809,6 +813,8 @@ static int handle_request_for_tables(char *tables, uint length) ptr= strxmov(ptr, " ", options, NullS); query_length= (uint) (ptr - query); } + if (verbose >= 3) + puts(query); if (mysql_real_query(sock, query, query_length)) { sprintf(message, "when executing '%s TABLE ... %s'", op, options); @@ -1061,7 +1067,7 @@ int main(int argc, char **argv) for (i = 0; i < tables4rebuild.elements ; i++) rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); for (i = 0; i < alter_table_cmds.elements ; i++) - run_query((char*) dynamic_array_ptr(&alter_table_cmds, i)); + run_query((char*) dynamic_array_ptr(&alter_table_cmds, i), 1); } ret= MY_TEST(first_error); |