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,
99
*log_error_file= NULL;
100
static char **defaults_argv= 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,
105
static char **defaults_argv= NULL;
101
106
static char compatible_mode_normal_str[255];
102
107
/* Server supports character_set_results session variable? */
103
108
static bool server_supports_switching_charsets= true;
297
303
0, 0, 0, 0, 0, 0},
298
304
{"lock-tables", 'l', "Lock all tables for read.", (char**) &lock_tables,
299
305
(char**) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
300
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
301
(char**) &log_error_file, (char**) &log_error_file, 0, GET_STR,
302
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
303
306
{"master-data", OPT_MASTER_DATA,
304
307
"This causes the binary log position and filename to be appended to the "
305
308
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
342
345
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
343
346
"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
347
(char**) &opt_order_by_primary, (char**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
346
349
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
347
350
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,
351
{"port", 'p', "Port number to use for connection.",
352
0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
351
353
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
352
354
(char**) &quick, (char**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
353
355
{"quote-names",'Q', "Quote table and column names with backticks (`).",
596
598
bool get_one_option(int optid, const struct my_option *, char *argument)
601
uint64_t temp_drizzle_port= 0;
605
temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
606
/* if there is an alpha character this is not a valid port */
607
if (strlen(endchar) != 0)
609
fprintf(stderr, _("Non-integer value supplied for port. If you are trying to enter a password please use --password instead.\n"));
612
/* If the port number is > 65535 it is not a valid port
613
* This also helps with potential data loss casting unsigned long to a
615
if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
617
fprintf(stderr, _("Value supplied for port is not valid.\n"));
622
opt_drizzle_port= (uint32_t) temp_drizzle_port;
602
char *start=argument;
628
char *start= argument;
603
629
if (opt_password)
604
630
free(opt_password);
605
opt_password=strdup(argument);
631
opt_password= strdup(argument);
606
632
if (opt_password == NULL)
608
634
fprintf(stderr, "Memory allocation error while copying password. "
612
while (*argument) *argument++= 'x'; /* Destroy argument */
640
/* Overwriting password with 'x' */
614
start[1]=0; /* Cut length of argument */
645
/* Cut length of argument */
621
656
if (!(md_result_file= my_fopen(argument, O_WRONLY,