44
47
static char *add_load_option(char *ptr,const char *object,
45
48
const char *statement);
47
static bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
48
opt_replace=0,silent=0,ignore=0,opt_compress=0,
49
opt_low_priority= 0, tty_password= 0;
50
static bool debug_info_flag= 0, debug_check_flag= 0;
51
static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0;
52
static char *opt_password=0, *current_user=0,
53
*current_host=0, *current_db=0, *fields_terminated=0,
54
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
55
*escaped=0, *opt_columns=0,
50
static bool verbose= false, lock_tables= false, ignore_errors= false,
51
opt_delete= false, opt_replace= false, silent= false,
52
ignore= false, opt_compress= false, opt_low_priority= false,
54
static bool debug_info_flag= false, debug_check_flag= false;
55
static uint opt_use_threads= 0, opt_local_file= 0, my_end_arg= 0;
56
static char *opt_password= NULL, *current_user= NULL,
57
*current_host= NULL, *current_db= NULL, *fields_terminated= NULL,
58
*lines_terminated= NULL, *enclosed= NULL, *opt_enclosed= NULL,
59
*escaped= NULL, *opt_columns= NULL,
56
60
*default_charset= (char*) DRIZZLE_DEFAULT_CHARSET_NAME;
57
static uint opt_drizzle_port= 0, opt_protocol= 0;
58
static char * opt_drizzle_unix_port=0;
61
static uint opt_protocol= 0;
62
static uint32_t opt_drizzle_port= 0;
63
static char * opt_drizzle_unix_port= 0;
59
64
static int64_t opt_ignore_lines= -1;
60
65
static const CHARSET_INFO *charset_info= &my_charset_utf8_general_ci;
119
124
{"low-priority", OPT_LOW_PRIORITY,
120
125
"Use LOW_PRIORITY when updating the table.", (char**) &opt_low_priority,
121
126
(char**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
123
128
"Password to use when connecting to server. If password is not given it's asked from the tty.",
124
129
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
125
{"port", 'P', "Port number to use for connection or 0 for default to, in "
130
{"port", 'p', "Port number to use for connection or 0 for default to, in "
126
131
"order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
127
132
"built-in default (" STRINGIFY_ARG(DRIZZLE_PORT) ").",
128
(char**) &opt_drizzle_port,
129
(char**) &opt_drizzle_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
133
0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
131
134
{"protocol", OPT_DRIZZLE_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
132
135
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
133
136
{"replace", 'r', "If duplicate unique key was found, replace old row.",
185
188
bool get_one_option(int optid, const struct my_option *, char *argument)
191
uint64_t temp_drizzle_port= 0;
195
temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
196
/* if there is an alpha character this is not a valid port */
197
if (strlen(endchar) != 0)
199
fprintf(stderr, _("Non-integer value supplied for port. If you are trying to enter a password please use --password instead.\n"));
202
/* If the port number is > 65535 it is not a valid port
203
This also helps with potential data loss casting unsigned long to a
205
if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
207
fprintf(stderr, _("Value supplied for port is not valid.\n"));
212
opt_drizzle_port= (uint32_t) temp_drizzle_port;
191
218
char *start=argument;