291
291
auto_vertical_output= false,
292
292
show_warnings= false, executing_query= false, interrupted_query= false,
293
293
use_drizzle_protocol= false, opt_local_infile;
294
static uint32_t opt_kill= 0;
294
295
static uint32_t show_progress_size= 0;
295
296
static bool column_types_flag;
296
297
static bool preserve_comments= false;
297
298
static uint32_t opt_max_input_line;
298
299
static uint32_t opt_drizzle_port= 0;
299
300
static int opt_silent, verbose= 0;
300
static drizzle_capabilities_t connect_flag= DRIZZLE_CAPABILITIES_NONE;
301
301
static char *histfile;
302
302
static char *histfile_tmp;
303
303
static string *glob_buffer;
1226
static bool kill_query(uint32_t query_id)
1228
drizzle_result_st result;
1229
drizzle_return_t ret;
1233
printf(_("killing query %u"), query_id);
1237
if (drizzle_kill(&con, &result, query_id,
1238
&ret) == NULL || ret != DRIZZLE_RETURN_OK)
1240
if (ret == DRIZZLE_RETURN_ERROR_CODE)
1242
fprintf(stderr, _("kill failed; error: '%s'"),
1243
drizzle_result_error(&result));
1244
drizzle_result_free(&result);
1248
fprintf(stderr, _("kill failed; error: '%s'"),
1249
drizzle_con_error(&con));
1254
drizzle_result_free(&result);
1257
printf(_("done\n"));
1227
1263
Ping the server that we are currently connected to.
1409
1455
("shutdown", po::value<bool>()->zero_tokens(),
1410
1456
_("Shutdown the server"))
1411
1457
("silent,s", _("Be more silent. Print results with a tab as separator, each row on new line."))
1458
("kill", po::value<uint32_t>(&opt_kill)->default_value(0),
1459
_("Kill a running query."))
1412
1460
("tee", po::value<string>(),
1413
1461
_("Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default."))
1414
1462
("disable-tee", po::value<bool>()->default_value(false)->zero_tokens(),
4175
4222
drizzle_create(&drizzle);
4177
4224
#ifdef DRIZZLE_ADMIN_TOOL
4178
drizzle_con_options_t options= (drizzle_con_options_t) (DRIZZLE_CON_ADMIN | (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL));
4225
drizzle_con_options_t options= (drizzle_con_options_t) (DRIZZLE_CON_ADMIN | (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE));
4180
drizzle_con_options_t options= (drizzle_con_options_t) (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL);
4227
drizzle_con_options_t options= (drizzle_con_options_t) (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE);
4183
4230
if (drizzle_con_add_tcp(&drizzle, &con, (char *)host.c_str(),
4184
opt_drizzle_port, (char *)user.c_str(),
4185
(char *)password.c_str(), (char *)database.c_str(),
4231
opt_drizzle_port, (char *)user.c_str(),
4232
(char *)password.c_str(), (char *)database.c_str(),
4188
4235
(void) put_error(&con, NULL);
4189
4236
(void) fflush(stdout);
4193
/* XXX add this back in
4194
if (opt_connect_timeout)
4196
uint32_t timeout=opt_connect_timeout;
4197
drizzleclient_options(&drizzle,DRIZZLE_OPT_CONNECT_TIMEOUT,
4202
/* XXX Do we need this?
4205
char init_command[100];
4206
sprintf(init_command,
4207
"SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%"PRIu32
4208
",MAX_JOIN_SIZE=%"PRIu32,
4209
select_limit, max_join_size);
4210
drizzleclient_options(&drizzle, DRIZZLE_INIT_COMMAND, init_command);
4213
4240
if ((ret= drizzle_con_connect(&con)) != DRIZZLE_RETURN_OK)