69
71
char **err_pos, uint *err_len);
71
73
static void field_escape(string &in, const char *from);
72
static bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
73
quick= 1, extended_insert= 1,
74
lock_tables=1,ignore_errors=0,flush_logs=0,
75
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
76
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
77
opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,
78
opt_set_charset=0, opt_dump_date=1,
79
opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
80
opt_delete_master_logs=0, tty_password=0,
81
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
82
opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
83
opt_complete_insert= 0, opt_drop_database= 0,
87
opt_include_master_host_port= 0,
89
static bool debug_info_flag= 0, debug_check_flag= 0;
74
static bool verbose= false, opt_no_create_info= false, opt_no_data= false,
75
quick= true, extended_insert= true,
76
lock_tables= true, ignore_errors= false, flush_logs= false,
77
opt_drop= true, opt_keywords= false,
78
opt_lock= true, opt_compress= false,
79
opt_delayed= false, create_options= true, opt_quoted= false,
80
opt_databases= false, opt_alldbs= false, opt_create_db= false,
81
opt_lock_all_tables= false,
82
opt_set_charset= false, opt_dump_date= true,
83
opt_autocommit= false, opt_disable_keys= true, opt_xml= false,
84
opt_delete_master_logs= false, tty_password= false,
85
opt_single_transaction= false, opt_comments= false,
86
opt_compact= false, opt_hex_blob= false,
87
opt_order_by_primary=false, opt_ignore= false,
88
opt_complete_insert= false, opt_drop_database= false,
89
opt_replace_into= false,
91
opt_slave_apply= false,
92
opt_include_master_host_port= false,
94
static bool debug_info_flag= false, debug_check_flag= false;
90
95
static uint32_t opt_max_allowed_packet, opt_net_buffer_length;
91
static DRIZZLE drizzle_connection,*drizzle=0;
96
static DRIZZLE drizzle_connection, *drizzle= 0;
92
97
static string insert_pat;
93
static char *opt_password=0,*current_user=0,
94
*current_host=0,*path=0,*fields_terminated=0,
95
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
96
*where=0, *order_by=0,
97
*opt_compatible_mode_str= 0,
98
static char *opt_password= NULL, *current_user= NULL,
99
*current_host= NULL, *path= NULL, *fields_terminated= NULL,
100
*lines_terminated= NULL, *enclosed= NULL, *opt_enclosed= NULL,
102
*where= NULL, *order_by= NULL,
103
*opt_compatible_mode_str= NULL,
99
105
*log_error_file= NULL;
100
static char **defaults_argv= 0;
106
static char **defaults_argv= NULL;
101
107
static char compatible_mode_normal_str[255];
102
108
/* Server supports character_set_results session variable? */
103
109
static bool server_supports_switching_charsets= true;
342
349
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
343
350
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
344
351
(char**) &opt_order_by_primary, (char**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
346
353
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
347
354
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
348
{"port", 'P', "Port number to use for connection.", (char**) &opt_drizzle_port,
349
(char**) &opt_drizzle_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
355
{"port", 'p', "Port number to use for connection.",
356
0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
351
357
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
352
358
(char**) &quick, (char**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
353
359
{"quote-names",'Q', "Quote table and column names with backticks (`).",
596
602
bool get_one_option(int optid, const struct my_option *, char *argument)
605
uint64_t temp_drizzle_port= 0;
609
temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
610
/* if there is an alpha character this is not a valid port */
611
if (strlen(endchar) != 0)
613
fprintf(stderr, _("Non-integer value supplied for port. If you are trying to enter a password please use --password instead.\n"));
616
/* If the port number is > 65535 it is not a valid port
617
* This also helps with potential data loss casting unsigned long to a
619
if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
621
fprintf(stderr, _("Value supplied for port is not valid.\n"));
626
opt_drizzle_port= (uint32_t) temp_drizzle_port;
602
char *start=argument;
632
char *start= argument;
603
633
if (opt_password)
604
634
free(opt_password);
605
opt_password=strdup(argument);
635
opt_password= strdup(argument);
606
636
if (opt_password == NULL)
608
638
fprintf(stderr, "Memory allocation error while copying password. "
612
while (*argument) *argument++= 'x'; /* Destroy argument */
644
/* Overwriting password with 'x' */
614
start[1]=0; /* Cut length of argument */
649
/* Cut length of argument */
621
660
if (!(md_result_file= my_fopen(argument, O_WRONLY,