Port mysql_upgrade to be tested on windows

parent 4dc0aeb7
...@@ -31,10 +31,12 @@ ...@@ -31,10 +31,12 @@
const char *mysqlcheck_name= "mysqlcheck.exe"; const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe"; const char *mysql_name= "mysql.exe";
const char *mysqld_name= "mysqld.exe"; const char *mysqld_name= "mysqld.exe";
#define EXTRA_CLIENT_PATHS "client/release", "client/debug"
#else #else
const char *mysqlcheck_name= "mysqlcheck"; const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql"; const char *mysql_name= "mysql";
const char *mysqld_name= "mysqld"; const char *mysqld_name= "mysqld";
#define EXTRA_CLIENT_PATHS "client"
#endif /*__WIN__*/ #endif /*__WIN__*/
extern TYPELIB sql_protocol_typelib; extern TYPELIB sql_protocol_typelib;
...@@ -497,8 +499,9 @@ int main(int argc, char **argv) ...@@ -497,8 +499,9 @@ int main(int argc, char **argv)
"mysql", NullS)) "mysql", NullS))
{ {
ret= 1; ret= 1;
puts("Can't find data directory. Please restart with" fprintf(stderr,
" --datadir=path-to-writable-data-dir"); "Can't find data directory. Please restart with"
" --datadir=path-to-writable-data-dir");
goto error; goto error;
} }
...@@ -541,11 +544,13 @@ int main(int argc, char **argv) ...@@ -541,11 +544,13 @@ int main(int argc, char **argv)
} }
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path), if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
"bin", "client", NullS)) "bin", EXTRA_CLIENT_PATHS, NullS))
{ {
ret= 1; ret= 1;
printf("Can't find program '%s'\n", mysqlcheck_name); fprintf(stderr,
puts("Please restart with --basedir=mysql-install-directory"); "Can't find program '%s'\n"
"Please restart with --basedir=mysql-install-directory",
mysqlcheck_name);
goto error; goto error;
} }
else else
...@@ -567,7 +572,7 @@ int main(int argc, char **argv) ...@@ -567,7 +572,7 @@ int main(int argc, char **argv)
ret= system(cmdline.str); ret= system(cmdline.str);
if (ret) if (ret)
{ {
printf("Error executing '%s'\n", cmdline.str); fprintf(stderr, "Error executing '%s'\n", cmdline.str);
goto error; goto error;
} }
...@@ -578,12 +583,13 @@ int main(int argc, char **argv) ...@@ -578,12 +583,13 @@ int main(int argc, char **argv)
fix_priv_tables: fix_priv_tables:
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path), if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
"bin", "client", NullS)) "bin", EXTRA_CLIENT_PATHS, NullS))
{ {
ret= 1; ret= 1;
puts("Could not find MySQL command-line client (mysql).\n" fprintf(stderr,
"Please use --basedir to specify the directory" "Could not find MySQL command-line client (mysql).\n"
" where MySQL is installed."); "Please use --basedir to specify the directory"
" where MySQL is installed.");
goto error; goto error;
} }
else else
...@@ -598,9 +604,10 @@ int main(int argc, char **argv) ...@@ -598,9 +604,10 @@ int main(int argc, char **argv)
"share/mysql", NullS)) "share/mysql", NullS))
{ {
ret= 1; ret= 1;
puts("Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n" fprintf(stderr,
"Please use --basedir to specify the directory" "Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
" where MySQL is installed"); "Please use --basedir to specify the directory"
" where MySQL is installed");
goto error; goto error;
} }
else else
...@@ -621,7 +628,7 @@ int main(int argc, char **argv) ...@@ -621,7 +628,7 @@ int main(int argc, char **argv)
ret= system(cmdline.str); ret= system(cmdline.str);
if (ret) if (ret)
printf("Error executing '%s'\n", cmdline.str); fprintf(stderr, "Error executing '%s'\n", cmdline.str);
error: error:
dynstr_free(&cmdline); dynstr_free(&cmdline);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment