58
54
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
59
55
static uint opt_mysql_port= 0, opt_protocol= 0;
60
56
static char * opt_mysql_unix_port=0;
61
static longlong opt_ignore_lines= -1;
57
static int64_t opt_ignore_lines= -1;
62
58
static CHARSET_INFO *charset_info= &my_charset_latin1;
65
static char *shared_memory_base_name=0;
68
60
static struct my_option my_long_options[] =
70
62
{"character-sets-dir", OPT_CHARSETS_DIR,
71
"Directory where character sets are.", (uchar**) &charsets_dir,
72
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
63
"Directory where character sets are.", (char**) &charsets_dir,
64
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
73
65
{"default-character-set", OPT_DEFAULT_CHARSET,
74
"Set the default character set.", (uchar**) &default_charset,
75
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
66
"Set the default character set.", (char**) &default_charset,
67
(char**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
77
69
"Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE.",
78
(uchar**) &opt_columns, (uchar**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
70
(char**) &opt_columns, (char**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
80
72
{"compress", 'C', "Use compression in server/client protocol.",
81
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
73
(char**) &opt_compress, (char**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
83
75
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
84
76
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
85
77
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
86
(uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
78
(char**) &debug_check_flag, (char**) &debug_check_flag, 0,
87
79
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
88
80
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
89
(uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
81
(char**) &debug_info_flag, (char**) &debug_info_flag,
90
82
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
91
{"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
92
(uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
83
{"delete", 'd', "First delete all rows from table.", (char**) &opt_delete,
84
(char**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
93
85
{"fields-terminated-by", OPT_FTB,
94
"Fields in the textfile are terminated by ...", (uchar**) &fields_terminated,
95
(uchar**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
86
"Fields in the textfile are terminated by ...", (char**) &fields_terminated,
87
(char**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
96
88
{"fields-enclosed-by", OPT_ENC,
97
"Fields in the importfile are enclosed by ...", (uchar**) &enclosed,
98
(uchar**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
89
"Fields in the importfile are enclosed by ...", (char**) &enclosed,
90
(char**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
99
91
{"fields-optionally-enclosed-by", OPT_O_ENC,
100
"Fields in the i.file are opt. enclosed by ...", (uchar**) &opt_enclosed,
101
(uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
92
"Fields in the i.file are opt. enclosed by ...", (char**) &opt_enclosed,
93
(char**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
102
94
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
103
(uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
95
(char**) &escaped, (char**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
105
97
{"force", 'f', "Continue even if we get an sql-error.",
106
(uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
98
(char**) &ignore_errors, (char**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
108
100
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG,
109
101
0, 0, 0, 0, 0, 0},
110
{"host", 'h', "Connect to host.", (uchar**) ¤t_host,
111
(uchar**) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
102
{"host", 'h', "Connect to host.", (char**) ¤t_host,
103
(char**) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
112
104
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
113
(uchar**) &ignore, (uchar**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
105
(char**) &ignore, (char**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
114
106
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
115
(uchar**) &opt_ignore_lines, (uchar**) &opt_ignore_lines, 0, GET_LL,
107
(char**) &opt_ignore_lines, (char**) &opt_ignore_lines, 0, GET_LL,
116
108
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
117
109
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
118
(uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
110
(char**) &lines_terminated, (char**) &lines_terminated, 0, GET_STR,
119
111
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
120
{"local", 'L', "Read all files through the client.", (uchar**) &opt_local_file,
121
(uchar**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
112
{"local", 'L', "Read all files through the client.", (char**) &opt_local_file,
113
(char**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
122
114
{"lock-tables", 'l', "Lock all tables for write (this disables threads).",
123
(uchar**) &lock_tables, (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG,
115
(char**) &lock_tables, (char**) &lock_tables, 0, GET_BOOL, NO_ARG,
124
116
0, 0, 0, 0, 0, 0},
125
117
{"low-priority", OPT_LOW_PRIORITY,
126
"Use LOW_PRIORITY when updating the table.", (uchar**) &opt_low_priority,
127
(uchar**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
118
"Use LOW_PRIORITY when updating the table.", (char**) &opt_low_priority,
119
(char**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
128
120
{"password", 'p',
129
121
"Password to use when connecting to server. If password is not given it's asked from the tty.",
130
122
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
134
126
"/etc/services, "
136
128
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
137
(uchar**) &opt_mysql_port,
138
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
129
(char**) &opt_mysql_port,
130
(char**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
140
132
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
141
133
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
142
134
{"replace", 'r', "If duplicate unique key was found, replace old row.",
143
(uchar**) &replace, (uchar**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
145
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
146
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
147
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
149
{"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent, 0,
135
(char**) &replace, (char**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
136
{"silent", 's', "Be more silent.", (char**) &silent, (char**) &silent, 0,
150
137
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
151
138
{"socket", 'S', "Socket file to use for connection.",
152
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
139
(char**) &opt_mysql_unix_port, (char**) &opt_mysql_unix_port, 0, GET_STR,
153
140
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
154
141
{"use-threads", OPT_USE_THREADS,
155
142
"Load files in parallel. The argument is the number "
156
143
"of threads to use for loading data.",
157
(uchar**) &opt_use_threads, (uchar**) &opt_use_threads, 0,
144
(char**) &opt_use_threads, (char**) &opt_use_threads, 0,
158
145
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
159
146
#ifndef DONT_ALLOW_USER_CHANGE
160
{"user", 'u', "User for login if not current user.", (uchar**) ¤t_user,
161
(uchar**) ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
147
{"user", 'u', "User for login if not current user.", (char**) ¤t_user,
148
(char**) ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
163
{"verbose", 'v', "Print info about the various stages.", (uchar**) &verbose,
164
(uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
150
{"verbose", 'v', "Print info about the various stages.", (char**) &verbose,
151
(char**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
165
152
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
166
153
NO_ARG, 0, 0, 0, 0, 0, 0},
167
154
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}