148
147
typedef enum enum_info_type INFO_TYPE;
150
149
static DRIZZLE drizzle; /* The connection */
151
static bool ignore_errors=0,quick=0,
152
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
153
opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
154
opt_compress=0, using_opt_local_infile=0,
155
vertical=0, line_numbers=1, column_names=1,
156
opt_nopager=1, opt_outfile=0, named_cmds= 0,
157
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
158
default_charset_used= 0, opt_secure_auth= 0,
159
default_pager_set= 0, opt_sigint_ignore= 0,
160
auto_vertical_output= 0,
161
show_warnings= 0, executing_query= 0, interrupted_query= 0;
150
static bool ignore_errors= false, quick= false,
151
connected= false, opt_raw_data= false, unbuffered= false,
152
output_tables= false, opt_rehash= true, skip_updates= false,
153
safe_updates= false, one_database= false,
154
opt_compress= false, using_opt_local_infile= false,
155
vertical= false, line_numbers= true, column_names= true,
156
opt_nopager= true, opt_outfile= false, named_cmds= false,
157
tty_password= false, opt_nobeep= false, opt_reconnect= true,
158
default_charset_used= false, opt_secure_auth= false,
159
default_pager_set= false, opt_sigint_ignore= false,
160
auto_vertical_output= false,
161
show_warnings= false, executing_query= false, interrupted_query= false;
162
162
static uint32_t show_progress_size= 0;
163
163
static bool debug_info_flag, debug_check_flag;
164
164
static bool column_types_flag;
165
static bool preserve_comments= 0;
166
static uint32_t opt_max_allowed_packet, opt_net_buffer_length;
167
static int verbose=0,opt_silent=0,opt_drizzle_port=0, opt_local_infile=0;
165
static bool preserve_comments= false;
166
static uint32_t opt_max_allowed_packet, opt_net_buffer_length,
168
static int verbose= 0, opt_silent= 0, opt_local_infile= 0;
168
169
static uint my_end_arg;
169
static char * opt_drizzle_unix_port=0;
170
static int connect_flag=CLIENT_INTERACTIVE;
171
static char *current_host,*current_db,*current_user=0,*opt_password=0,
172
*delimiter_str= 0,* current_prompt= 0;
170
static char * opt_drizzle_unix_port= NULL;
171
static int connect_flag= CLIENT_INTERACTIVE;
172
static char *current_host, *current_db, *current_user= NULL,
173
*opt_password= NULL, *delimiter_str= NULL, *current_prompt= NULL;
173
174
static char *histfile;
174
175
static char *histfile_tmp;
175
176
static string *glob_buffer;
176
177
static string *processed_prompt= NULL;
177
178
static char *default_prompt= NULL;
178
static char *full_username=0,*part_username=0;
179
static char *full_username= NULL,*part_username= NULL;
179
180
static STATUS status;
180
181
static uint32_t select_limit;
181
182
static uint32_t max_join_size;
182
183
static uint32_t opt_connect_timeout= 0;
183
184
static char drizzle_charsets_dir[FN_REFLEN+1];
184
185
// TODO: Need to i18n these
185
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
186
static const char *month_names[]={"Jan","Feb","Mar","Apr","May","Jun","Jul",
186
static const char *day_names[]= {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
187
static const char *month_names[]= {"Jan","Feb","Mar","Apr","May","Jun","Jul",
187
188
"Aug","Sep","Oct","Nov","Dec"};
188
189
static char default_pager[FN_REFLEN];
189
190
static char pager[FN_REFLEN], outfile[FN_REFLEN];
1364
1365
{"no-pager", OPT_NOPAGER,
1365
1366
N_("Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead."),
1366
1367
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1368
1369
N_("Password to use when connecting to server. If password is not given it's asked from the tty."),
1369
1370
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
1370
{"port", 'P', N_("Port number to use for connection or 0 for default to, in order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, ")
1371
{"port", 'p', N_("Port number to use for connection or 0 for default to, in order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, ")
1371
1372
N_("built-in default") " (" STRINGIFY_ARG(DRIZZLE_PORT) ").",
1372
(char**) &opt_drizzle_port,
1373
(char**) &opt_drizzle_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1373
0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1374
1374
{"prompt", OPT_PROMPT, N_("Set the drizzle prompt to this value."),
1375
1375
(char**) ¤t_prompt, (char**) ¤t_prompt, 0, GET_STR_ALLOC,
1376
1376
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1567
1570
one_database= skip_updates= 1;
1573
temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
1574
/* if there is an alpha character this is not a valid port */
1575
if (strlen(endchar) != 0)
1577
put_info(_("Non-integer value supplied for port. If you are trying to enter a password please use --password instead."), INFO_ERROR, 0, 0);
1580
/* If the port number is > 65535 it is not a valid port
1581
This also helps with potential data loss casting unsigned long to a
1583
if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
1585
put_info(_("Value supplied for port is not valid."), INFO_ERROR, 0, 0);
1590
opt_drizzle_port= (uint32_t) temp_drizzle_port;
1594
/* Don't require password */
1570
1595
if (argument == disabled_my_option)
1571
argument= (char*) ""; // Don't require password
1597
argument= (char*) "";
1574
1601
char *start= argument;
1575
1602
free(opt_password);
1576
1603
opt_password= strdup(argument);
1577
while (*argument) *argument++= 'x'; // Destroy argument
1606
/* Overwriting password with 'x' */
1580
1613
tty_password= 0;
1583
1617
tty_password= 1;
1586
1621
if (argument == disabled_my_option)