- Added new type GET_STRALC to my_getopt.
- Fixed some bugs, wrongly freed pointers, in some clients. - Removed unneccessary code. - Fixed some other minor bugs and added some options into variables category, which had accidently been left out earlier. client/mysql.cc: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqladmin.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqlcheck.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqldump.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqlimport.c: Removed unneccessary code. Fixed a bug in option --ignore-lines client/mysqlshow.c: Removed unneccessary code. include/my_getopt.h: Added new type, GET_STRALC. The name stands for GET STRING ALLOC, which means that the struct member value and u_max_value are strings that must be alloced and freed when used. The normal GET_STR works similarly otherwise, except that it's arguments are just pointers to strings, not alloced ones. mysys/my_getopt.c: Added support for GET_STRALC
This commit is contained in:
parent
f20dda3ea9
commit
21c1e5be44
@ -41,7 +41,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <violite.h>
|
#include <violite.h>
|
||||||
|
|
||||||
const char *VER= "12.4";
|
const char *VER= "12.5";
|
||||||
|
|
||||||
/* Don't try to make a nice table if the data is too big */
|
/* Don't try to make a nice table if the data is too big */
|
||||||
#define MAX_COLUMN_LENGTH 1024
|
#define MAX_COLUMN_LENGTH 1024
|
||||||
@ -458,8 +458,8 @@ static struct my_option my_long_options[] =
|
|||||||
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
|
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
|
||||||
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
{"database", 'D', "Database to use.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0,
|
{"database", 'D', "Database to use.", (gptr*) ¤t_db,
|
||||||
0, 0, 0, 0},
|
(gptr*) ¤t_db, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"execute", 'e', "Execute command and quit. (Output like with --batch).", 0,
|
{"execute", 'e', "Execute command and quit. (Output like with --batch).", 0,
|
||||||
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"vertical", 'E', "Print the output of a query (rows) vertically.",
|
{"vertical", 'E', "Print the output of a query (rows) vertically.",
|
||||||
@ -478,10 +478,10 @@ static struct my_option my_long_options[] =
|
|||||||
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
|
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
|
||||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"no-beep", 'b', "Turn off beep on error.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
|
||||||
0, 0, 0, 0, 0},
|
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
|
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
|
||||||
(gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_host, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"html", 'H', "Produce HTML output.", (gptr*) &opt_html, (gptr*) &opt_html,
|
{"html", 'H', "Produce HTML output.", (gptr*) &opt_html, (gptr*) &opt_html,
|
||||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"xml", 'X', "Produce XML output", (gptr*) &opt_xml, (gptr*) &opt_xml, 0,
|
{"xml", 'X', "Produce XML output", (gptr*) &opt_xml, (gptr*) &opt_xml, 0,
|
||||||
@ -527,8 +527,9 @@ static struct my_option my_long_options[] =
|
|||||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
||||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.", 0, 0, 0,
|
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_prompt, (gptr*) ¤t_prompt, 0, GET_STRALC,
|
||||||
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"quick", 'q',
|
{"quick", 'q',
|
||||||
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file. ",
|
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file. ",
|
||||||
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -538,7 +539,8 @@ static struct my_option my_long_options[] =
|
|||||||
{"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
{"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
{"socket", 'S', "Socket file to use for connection.",
|
{"socket", 'S', "Socket file to use for connection.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STRALC,
|
||||||
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#include "sslopt-longopts.h"
|
#include "sslopt-longopts.h"
|
||||||
{"table", 't', "Output in table format.", (gptr*) &output_tables,
|
{"table", 't', "Output in table format.", (gptr*) &output_tables,
|
||||||
(gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -549,7 +551,7 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
#ifndef DONT_ALLOW_USER_CHANGE
|
||||||
{"user", 'u', "User for login if not current user.", (gptr*) ¤t_user,
|
{"user", 'u', "User for login if not current user.", (gptr*) ¤t_user,
|
||||||
(gptr*) ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_user, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
|
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
|
||||||
(gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, OPT_ARG, 0, 0,
|
(gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, OPT_ARG, 0, 0,
|
||||||
@ -602,16 +604,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
char *argument)
|
char *argument)
|
||||||
{
|
{
|
||||||
switch(optid) {
|
switch(optid) {
|
||||||
case OPT_DEFAULT_CHARSET:
|
|
||||||
default_charset= argument;
|
|
||||||
break;
|
|
||||||
case OPT_CHARSETS_DIR:
|
case OPT_CHARSETS_DIR:
|
||||||
strmov(mysql_charsets_dir, argument);
|
strmov(mysql_charsets_dir, argument);
|
||||||
charsets_dir = mysql_charsets_dir;
|
charsets_dir = mysql_charsets_dir;
|
||||||
break;
|
break;
|
||||||
case OPT_LOCAL_INFILE:
|
case OPT_LOCAL_INFILE:
|
||||||
using_opt_local_infile=1;
|
using_opt_local_infile=1;
|
||||||
opt_local_infile= test(!optarg || atoi(optarg)>0);
|
opt_local_infile= test(!argument || atoi(argument)>0);
|
||||||
break;
|
break;
|
||||||
case OPT_TEE:
|
case OPT_TEE:
|
||||||
if (argument == disabled_my_option)
|
if (argument == disabled_my_option)
|
||||||
@ -646,20 +645,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
printf("WARNING: option depricated; use --disable-pager instead.\n");
|
printf("WARNING: option depricated; use --disable-pager instead.\n");
|
||||||
opt_nopager= 1;
|
opt_nopager= 1;
|
||||||
break;
|
break;
|
||||||
case OPT_PROMPT:
|
|
||||||
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_prompt=my_strdup(optarg,MYF(MY_FAE));
|
|
||||||
break;
|
|
||||||
case 'A':
|
case 'A':
|
||||||
rehash= 0;
|
rehash= 0;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
|
||||||
opt_nobeep = 1;
|
|
||||||
break;
|
|
||||||
case 'D':
|
|
||||||
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_db= my_strdup(argument, MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
case 'e':
|
case 'e':
|
||||||
status.batch= 1;
|
status.batch= 1;
|
||||||
status.add_to_history= 0;
|
status.add_to_history= 0;
|
||||||
@ -668,16 +656,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
return 1;
|
return 1;
|
||||||
ignore_errors= 0;
|
ignore_errors= 0;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
my_free(current_host, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_host= my_strdup(argument, MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
my_free(current_user, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_user= my_strdup(argument, MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (argument == disabled_my_option)
|
if (argument == disabled_my_option)
|
||||||
one_database= 0;
|
one_database= 0;
|
||||||
@ -726,13 +704,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
opt_silent++; // more silent
|
opt_silent++; // more silent
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'P':
|
|
||||||
opt_mysql_port= (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'S':
|
|
||||||
my_free(opt_mysql_unix_port, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
opt_mysql_unix_port= my_strdup(argument, MYF(0));
|
|
||||||
break;
|
|
||||||
case 'W':
|
case 'W':
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <my_pthread.h> /* because of signal() */
|
#include <my_pthread.h> /* because of signal() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ADMIN_VERSION "8.31"
|
#define ADMIN_VERSION "8.32"
|
||||||
#define MAX_MYSQL_VAR 64
|
#define MAX_MYSQL_VAR 64
|
||||||
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
||||||
#define MAX_TRUNC_LENGTH 3
|
#define MAX_TRUNC_LENGTH 3
|
||||||
@ -136,14 +136,15 @@ static struct my_option my_long_options[] =
|
|||||||
{"silent", 's', "Silently exit if one can't connect to server",
|
{"silent", 's', "Silently exit if one can't connect to server",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"socket", 'S', "Socket file to use for connection.",
|
{"socket", 'S', "Socket file to use for connection.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &unix_port, (gptr*) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
|
||||||
|
0, 0, 0},
|
||||||
{"sleep", 'i', "Execute commands again and again with a sleep between.",
|
{"sleep", 'i', "Execute commands again and again with a sleep between.",
|
||||||
(gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
|
(gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
#include "sslopt-longopts.h"
|
#include "sslopt-longopts.h"
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
#ifndef DONT_ALLOW_USER_CHANGE
|
||||||
{"user", 'u', "User for login if not current user.", (gptr*) &user,
|
{"user", 'u', "User for login if not current user.", (gptr*) &user,
|
||||||
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &user, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
{"verbose", 'v', "Write more information.", (gptr*) &opt_verbose,
|
{"verbose", 'v', "Write more information.", (gptr*) &opt_verbose,
|
||||||
(gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -174,10 +175,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
switch(optid) {
|
switch(optid) {
|
||||||
case 'h':
|
|
||||||
host = argument;
|
|
||||||
break;
|
|
||||||
case 'q': /* Allow old 'q' option */
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -191,23 +188,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
break;
|
break;
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
user= my_strdup(argument,MYF(0));
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'i':
|
|
||||||
interval=atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
tcp_port= (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 's':
|
case 's':
|
||||||
option_silent++;
|
option_silent++;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
|
||||||
unix_port= argument;
|
|
||||||
break;
|
|
||||||
case 'W':
|
case 'W':
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
unix_port=MYSQL_NAMEDPIPE;
|
unix_port=MYSQL_NAMEDPIPE;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
|
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
|
||||||
|
|
||||||
#define CHECK_VERSION "2.1"
|
#define CHECK_VERSION "2.2"
|
||||||
|
|
||||||
#include "client_priv.h"
|
#include "client_priv.h"
|
||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
@ -94,7 +94,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
|
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"host",'h', "Connect to host.", (gptr*) ¤t_host,
|
{"host",'h', "Connect to host.", (gptr*) ¤t_host,
|
||||||
(gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_host, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"medium-check", 'm',
|
{"medium-check", 'm',
|
||||||
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -199,12 +199,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'a':
|
case 'a':
|
||||||
what_to_do = DO_ANALYZE;
|
what_to_do = DO_ANALYZE;
|
||||||
break;
|
break;
|
||||||
case OPT_DEFAULT_CHARSET:
|
|
||||||
default_charset = argument;
|
|
||||||
break;
|
|
||||||
case OPT_CHARSETS_DIR:
|
|
||||||
charsets_dir = argument;
|
|
||||||
break;
|
|
||||||
case 'c':
|
case 'c':
|
||||||
what_to_do = DO_CHECK;
|
what_to_do = DO_CHECK;
|
||||||
break;
|
break;
|
||||||
@ -216,10 +210,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
case 'h':
|
|
||||||
my_free(current_host, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_host = my_strdup(argument, MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
case 'm':
|
case 'm':
|
||||||
what_to_do = DO_CHECK;
|
what_to_do = DO_CHECK;
|
||||||
opt_medium_check = 1;
|
opt_medium_check = 1;
|
||||||
@ -227,11 +217,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'o':
|
case 'o':
|
||||||
what_to_do = DO_OPTIMIZE;
|
what_to_do = DO_OPTIMIZE;
|
||||||
break;
|
break;
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
current_user = argument;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -245,15 +230,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
tty_password = 1;
|
tty_password = 1;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
|
||||||
opt_mysql_port = (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'r':
|
case 'r':
|
||||||
what_to_do = DO_REPAIR;
|
what_to_do = DO_REPAIR;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
|
||||||
opt_mysql_unix_port = argument;
|
|
||||||
break;
|
|
||||||
case 'W':
|
case 'W':
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
opt_mysql_unix_port = MYSQL_NAMEDPIPE;
|
opt_mysql_unix_port = MYSQL_NAMEDPIPE;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DUMP_VERSION "9.03"
|
#define DUMP_VERSION "9.04"
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@ -97,8 +97,9 @@ static struct my_option my_long_options[] =
|
|||||||
"Dump all the databases. This will be same as --databases with all databases selected.",
|
"Dump all the databases. This will be same as --databases with all databases selected.",
|
||||||
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
{"all", 'a', "Include all MySQL specific create options.", 0, 0, 0,
|
{"all", 'a', "Include all MySQL specific create options.",
|
||||||
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 0,
|
||||||
|
0, 0, 0, 0, 0},
|
||||||
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
|
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
|
||||||
(gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
(gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
@ -111,8 +112,8 @@ static struct my_option my_long_options[] =
|
|||||||
{"character-sets-dir", OPT_CHARSETS_DIR,
|
{"character-sets-dir", OPT_CHARSETS_DIR,
|
||||||
"Directory where character sets are", (gptr*) &charsets_dir,
|
"Directory where character sets are", (gptr*) &charsets_dir,
|
||||||
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"complete-insert", 'c', "Use complete insert statements.", 0, 0, 0,
|
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
|
||||||
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &cFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"compress", 'C', "Use compression in server/client protocol.",
|
{"compress", 'C', "Use compression in server/client protocol.",
|
||||||
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
@ -158,7 +159,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
|
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
|
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
|
||||||
(gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_host, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
|
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
|
||||||
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
|
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -176,9 +177,9 @@ static struct my_option my_long_options[] =
|
|||||||
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
|
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
|
||||||
0, 0, 0, 0},
|
0, 0, 0, 0},
|
||||||
{"no-create-info", 't', "Don't write table creation info.",
|
{"no-create-info", 't', "Don't write table creation info.",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &tFlag, (gptr*) &tFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"no-data", 'd', "No row information.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
|
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
|
||||||
0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"set-variable", 'O',
|
{"set-variable", 'O',
|
||||||
"Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
|
"Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -301,24 +302,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
opt_master_data=1;
|
opt_master_data=1;
|
||||||
opt_first_slave=1;
|
opt_first_slave=1;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
|
||||||
create_options=1;
|
|
||||||
break;
|
|
||||||
case OPT_DEFAULT_CHARSET:
|
|
||||||
default_charset= argument;
|
|
||||||
break;
|
|
||||||
case OPT_CHARSETS_DIR:
|
|
||||||
charsets_dir= argument;
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
current_host=my_strdup(argument,MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
current_user=argument;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -332,36 +315,23 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
|
||||||
opt_mysql_port= (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!(md_result_file = my_fopen(argument, O_WRONLY | O_BINARY,
|
if (!(md_result_file = my_fopen(argument, O_WRONLY | O_BINARY,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
|
||||||
opt_mysql_unix_port= argument;
|
|
||||||
break;
|
|
||||||
case 'W':
|
case 'W':
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
path= argument;
|
|
||||||
opt_disable_keys=0;
|
opt_disable_keys=0;
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : "d:t:o");
|
DBUG_PUSH(argument ? argument : "d:t:o");
|
||||||
break;
|
break;
|
||||||
case 'c': cFlag=1; break;
|
|
||||||
case 'd': dFlag=1; break;
|
|
||||||
case 't': tFlag=1; break;
|
|
||||||
case 'V': print_version(); exit(0);
|
case 'V': print_version(); exit(0);
|
||||||
case 'w':
|
|
||||||
where=argument;
|
|
||||||
break;
|
|
||||||
case 'X':
|
case 'X':
|
||||||
opt_xml = 1;
|
opt_xml = 1;
|
||||||
opt_disable_keys=0;
|
opt_disable_keys=0;
|
||||||
@ -370,21 +340,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
case (int) OPT_FTB:
|
|
||||||
fields_terminated= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_LTB:
|
|
||||||
lines_terminated= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_ENC:
|
|
||||||
enclosed= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_O_ENC:
|
|
||||||
opt_enclosed= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_ESC:
|
|
||||||
escaped= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_OPTIMIZE:
|
case (int) OPT_OPTIMIZE:
|
||||||
extended_insert=opt_drop=opt_lock=lock_tables=quick=create_options=
|
extended_insert=opt_drop=opt_lock=lock_tables=quick=create_options=
|
||||||
opt_disable_keys=1;
|
opt_disable_keys=1;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
** * *
|
** * *
|
||||||
** *************************
|
** *************************
|
||||||
*/
|
*/
|
||||||
#define IMPORT_VERSION "3.1"
|
#define IMPORT_VERSION "3.2"
|
||||||
|
|
||||||
#include "client_priv.h"
|
#include "client_priv.h"
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
@ -90,8 +90,9 @@ static struct my_option my_long_options[] =
|
|||||||
(gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
|
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
|
||||||
(gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", 0, 0,
|
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
|
||||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_STR,
|
||||||
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
|
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
|
||||||
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
|
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -166,23 +167,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
char *argument)
|
char *argument)
|
||||||
{
|
{
|
||||||
switch(optid) {
|
switch(optid) {
|
||||||
case 'c':
|
|
||||||
opt_columns= argument;
|
|
||||||
break;
|
|
||||||
case OPT_DEFAULT_CHARSET:
|
|
||||||
default_charset= argument;
|
|
||||||
break;
|
|
||||||
case OPT_CHARSETS_DIR:
|
|
||||||
charsets_dir= argument;
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
current_host= argument;
|
|
||||||
break;
|
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
current_user= argument;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -196,12 +180,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
tty_password= 1;
|
tty_password= 1;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
|
||||||
opt_mysql_port= (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'S':
|
|
||||||
opt_mysql_unix_port= argument;
|
|
||||||
break;
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
case 'W':
|
case 'W':
|
||||||
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
||||||
@ -216,24 +194,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
case (int) OPT_FTB:
|
|
||||||
fields_terminated= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_LTB:
|
|
||||||
lines_terminated= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_ENC:
|
|
||||||
enclosed= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_O_ENC:
|
|
||||||
opt_enclosed= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_ESC:
|
|
||||||
escaped= argument;
|
|
||||||
break;
|
|
||||||
case (int) OPT_IGN_LINES:
|
|
||||||
opt_ignore_lines= argument;
|
|
||||||
break;
|
|
||||||
#include "sslopt-case.h"
|
#include "sslopt-case.h"
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* Show databases, tables or columns */
|
/* Show databases, tables or columns */
|
||||||
|
|
||||||
#define SHOW_VERSION "9.1"
|
#define SHOW_VERSION "9.2"
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "client_priv.h"
|
#include "client_priv.h"
|
||||||
@ -198,15 +198,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
char *argument)
|
char *argument)
|
||||||
{
|
{
|
||||||
switch(optid) {
|
switch(optid) {
|
||||||
case 'c':
|
|
||||||
charsets_dir= argument;
|
|
||||||
break;
|
|
||||||
case 'v':
|
case 'v':
|
||||||
opt_verbose++;
|
opt_verbose++;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
host = argument;
|
|
||||||
break;
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -220,17 +214,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
break;
|
break;
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
|
||||||
case 'u':
|
|
||||||
user=argument;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'P':
|
|
||||||
opt_mysql_port= (unsigned int) atoi(argument);
|
|
||||||
break;
|
|
||||||
case 'S':
|
|
||||||
opt_mysql_unix_port= argument;
|
|
||||||
break;
|
|
||||||
case 'W':
|
case 'W':
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
opt_mysql_unix_port=MYSQL_NAMEDPIPE;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
C_MODE_START
|
C_MODE_START
|
||||||
|
|
||||||
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
|
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
|
||||||
GET_ULONG, GET_LL, GET_ULL, GET_STR };
|
GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STRALC };
|
||||||
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
|
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
|
||||||
|
|
||||||
struct my_option
|
struct my_option
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <my_sys.h>
|
||||||
|
|
||||||
static int findopt (char *optpat, uint length,
|
static int findopt (char *optpat, uint length,
|
||||||
const struct my_option **opt_res,
|
const struct my_option **opt_res,
|
||||||
@ -423,6 +424,12 @@ static int setval (const struct my_option *opts, char *argument,
|
|||||||
*((ulonglong*) result_pos)= getopt_ull(argument, opts, &err);
|
*((ulonglong*) result_pos)= getopt_ull(argument, opts, &err);
|
||||||
else if (opts->var_type == GET_STR)
|
else if (opts->var_type == GET_STR)
|
||||||
*((char**) result_pos)= argument;
|
*((char**) result_pos)= argument;
|
||||||
|
else if (opts->var_type == GET_STRALC)
|
||||||
|
{
|
||||||
|
if ((*((char**) result_pos)))
|
||||||
|
my_free((*(char**) result_pos), MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
*((char**) result_pos)= my_strdup(argument, MYF(MY_WME));
|
||||||
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return ERR_UNKNOWN_SUFFIX;
|
return ERR_UNKNOWN_SUFFIX;
|
||||||
}
|
}
|
||||||
@ -627,7 +634,7 @@ void my_print_help(const struct my_option *options)
|
|||||||
}
|
}
|
||||||
printf("--%s", optp->name);
|
printf("--%s", optp->name);
|
||||||
col+= 2 + strlen(optp->name);
|
col+= 2 + strlen(optp->name);
|
||||||
if (optp->var_type == GET_STR)
|
if (optp->var_type == GET_STR || optp->var_type == GET_STRALC)
|
||||||
{
|
{
|
||||||
printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "",
|
printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "",
|
||||||
optp->arg_type == OPT_ARG ? "]" : "");
|
optp->arg_type == OPT_ARG ? "]" : "");
|
||||||
@ -694,7 +701,7 @@ void my_print_variables(const struct my_option *options)
|
|||||||
length= strlen(optp->name);
|
length= strlen(optp->name);
|
||||||
for (; length < name_space; length++)
|
for (; length < name_space; length++)
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
if (optp->var_type == GET_STR)
|
if (optp->var_type == GET_STR || optp->var_type == GET_STRALC)
|
||||||
{
|
{
|
||||||
if (*((char**) optp->value))
|
if (*((char**) optp->value))
|
||||||
printf("%s\n", *((char**) optp->value));
|
printf("%s\n", *((char**) optp->value));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user