42
45
const char *statement);
44
47
static bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
45
replace=0,silent=0,ignore=0,opt_compress=0,
46
opt_low_priority= 0, tty_password= 0;
48
opt_replace=0,silent=0,ignore=0,opt_compress=0,
49
opt_low_priority= 0, tty_password= 0;
47
50
static bool debug_info_flag= 0, debug_check_flag= 0;
48
51
static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0;
49
52
static char *opt_password=0, *current_user=0,
128
131
{"protocol", OPT_DRIZZLE_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
129
132
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
130
133
{"replace", 'r', "If duplicate unique key was found, replace old row.",
131
(char**) &replace, (char**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
134
(char**) &opt_replace, (char**) &opt_replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
132
135
{"silent", 's', "Be more silent.", (char**) &silent, (char**) &silent, 0,
133
136
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
134
137
{"socket", 'S', "Socket file to use for connection.",
227
230
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
230
if (replace && ignore)
233
if (opt_replace && ignore)
232
235
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
290
293
opt_low_priority ? "LOW_PRIORITY" : "",
291
294
opt_local_file ? "LOCAL" : "", hard_path);
292
295
end= strend(sql_statement);
294
297
end= stpcpy(end, " REPLACE");
296
299
end= stpcpy(end, " IGNORE");
332
335
static void lock_table(DRIZZLE *drizzle, int tablecount, char **raw_tablename)
334
DYNAMIC_STRING query;
336
339
char tablename[FN_REFLEN];
339
342
fprintf(stdout, "Locking tables for write\n");
340
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
343
query.append("LOCK TABLES ");
341
344
for (i=0 ; i < tablecount ; i++)
343
346
fn_format(tablename, raw_tablename[i], "", "", 1 | 2);
344
dynstr_append(&query, tablename);
345
dynstr_append(&query, " WRITE,");
347
query.append(tablename);
348
query.append(" WRITE,");
347
if (drizzle_real_query(drizzle, query.str, query.length-1))
350
if (drizzle_real_query(drizzle, query.c_str(), query.length()-1))
348
351
db_error(drizzle); /* We shall countinue here, if --force was given */