2198
2198
item->maybe_null = 1;
2199
2199
field_list.push_back(item = new Item_empty_string("Msg_text", 255, cs));
2200
2200
item->maybe_null = 1;
2201
if (protocol->sendFields(&field_list))
2201
if (session->client->sendFields(&field_list))
2204
2204
for (table= tables; table; table= table->next_local)
2275
2275
/* purecov: begin inspected */
2276
2276
char buff[FN_REFLEN + DRIZZLE_ERRMSG_SIZE];
2277
2277
uint32_t length;
2278
protocol->prepareForResend();
2279
protocol->store(table_name);
2280
protocol->store(operator_name);
2281
protocol->store(STRING_WITH_LEN("error"));
2278
session->client->store(table_name);
2279
session->client->store(operator_name);
2280
session->client->store(STRING_WITH_LEN("error"));
2282
2281
length= snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
2284
protocol->store(buff, length);
2283
session->client->store(buff, length);
2285
2284
ha_autocommit_or_rollback(session, 0);
2286
2285
session->endTransaction(COMMIT);
2287
2286
session->close_thread_tables();
2288
2287
lex->reset_query_tables_list(false);
2289
2288
table->table=0; // For query cache
2290
if (protocol->write())
2289
if (session->client->flush())
2293
2292
/* purecov: end */
2313
2312
if (table->table->s->crashed && operator_func == &handler::ha_check)
2315
2314
/* purecov: begin inspected */
2316
protocol->prepareForResend();
2317
protocol->store(table_name);
2318
protocol->store(operator_name);
2319
protocol->store(STRING_WITH_LEN("warning"));
2320
protocol->store(STRING_WITH_LEN("Table is marked as crashed"));
2321
if (protocol->write())
2315
session->client->store(table_name);
2316
session->client->store(operator_name);
2317
session->client->store(STRING_WITH_LEN("warning"));
2318
session->client->store(STRING_WITH_LEN("Table is marked as crashed"));
2319
if (session->client->flush())
2323
2321
/* purecov: end */
2334
2332
DRIZZLE_ERROR *err;
2335
2333
while ((err= it++))
2337
protocol->prepareForResend();
2338
protocol->store(table_name);
2339
protocol->store(operator_name);
2340
protocol->store(warning_level_names[err->level].str,
2341
warning_level_names[err->level].length);
2342
protocol->store(err->msg);
2343
if (protocol->write())
2335
session->client->store(table_name);
2336
session->client->store(operator_name);
2337
session->client->store(warning_level_names[err->level].str,
2338
warning_level_names[err->level].length);
2339
session->client->store(err->msg);
2340
if (session->client->flush())
2346
2343
drizzle_reset_errors(session, true);
2348
protocol->prepareForResend();
2349
protocol->store(table_name);
2350
protocol->store(operator_name);
2345
session->client->store(table_name);
2346
session->client->store(operator_name);
2352
2348
send_result_message:
2357
2353
char buf[ERRMSGSIZE+20];
2358
2354
uint32_t length=snprintf(buf, ERRMSGSIZE,
2359
2355
ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
2360
protocol->store(STRING_WITH_LEN("note"));
2361
protocol->store(buf, length);
2356
session->client->store(STRING_WITH_LEN("note"));
2357
session->client->store(buf, length);
2365
2361
case HA_ADMIN_OK:
2366
protocol->store(STRING_WITH_LEN("status"));
2367
protocol->store(STRING_WITH_LEN("OK"));
2362
session->client->store(STRING_WITH_LEN("status"));
2363
session->client->store(STRING_WITH_LEN("OK"));
2370
2366
case HA_ADMIN_FAILED:
2371
protocol->store(STRING_WITH_LEN("status"));
2372
protocol->store(STRING_WITH_LEN("Operation failed"));
2367
session->client->store(STRING_WITH_LEN("status"));
2368
session->client->store(STRING_WITH_LEN("Operation failed"));
2375
2371
case HA_ADMIN_REJECT:
2376
protocol->store(STRING_WITH_LEN("status"));
2377
protocol->store(STRING_WITH_LEN("Operation need committed state"));
2372
session->client->store(STRING_WITH_LEN("status"));
2373
session->client->store(STRING_WITH_LEN("Operation need committed state"));
2378
2374
open_for_modify= false;
2381
2377
case HA_ADMIN_ALREADY_DONE:
2382
protocol->store(STRING_WITH_LEN("status"));
2383
protocol->store(STRING_WITH_LEN("Table is already up to date"));
2378
session->client->store(STRING_WITH_LEN("status"));
2379
session->client->store(STRING_WITH_LEN("Table is already up to date"));
2386
2382
case HA_ADMIN_CORRUPT:
2387
protocol->store(STRING_WITH_LEN("error"));
2388
protocol->store(STRING_WITH_LEN("Corrupt"));
2383
session->client->store(STRING_WITH_LEN("error"));
2384
session->client->store(STRING_WITH_LEN("Corrupt"));
2392
2388
case HA_ADMIN_INVALID:
2393
protocol->store(STRING_WITH_LEN("error"));
2394
protocol->store(STRING_WITH_LEN("Invalid argument"));
2389
session->client->store(STRING_WITH_LEN("error"));
2390
session->client->store(STRING_WITH_LEN("Invalid argument"));
2397
2393
case HA_ADMIN_TRY_ALTER:
2429
2425
if (session->is_error())
2431
2427
const char *err_msg= session->main_da.message();
2432
if (!session->protocol->isConnected())
2434
errmsg_printf(ERRMSG_LVL_ERROR, "%s", err_msg);
2438
/* Hijack the row already in-progress. */
2439
protocol->store(STRING_WITH_LEN("error"));
2440
protocol->store(err_msg);
2441
(void)protocol->write();
2442
/* Start off another row for HA_ADMIN_FAILED */
2443
protocol->prepareForResend();
2444
protocol->store(table_name);
2445
protocol->store(operator_name);
2428
/* Hijack the row already in-progress. */
2429
session->client->store(STRING_WITH_LEN("error"));
2430
session->client->store(err_msg);
2431
(void)session->client->flush();
2432
/* Start off another row for HA_ADMIN_FAILED */
2433
session->client->store(table_name);
2434
session->client->store(operator_name);
2447
2435
session->clear_error();
2458
2446
char buf[ERRMSGSIZE];
2459
2447
uint32_t length;
2461
protocol->store(STRING_WITH_LEN("error"));
2449
session->client->store(STRING_WITH_LEN("error"));
2462
2450
length=snprintf(buf, ERRMSGSIZE, ER(ER_TABLE_NEEDS_UPGRADE), table->table_name);
2463
protocol->store(buf, length);
2451
session->client->store(buf, length);
2471
2459
uint32_t length=snprintf(buf, ERRMSGSIZE,
2472
2460
_("Unknown - internal error %d during operation"),
2474
protocol->store(STRING_WITH_LEN("error"));
2475
protocol->store(buf, length);
2462
session->client->store(STRING_WITH_LEN("error"));
2463
session->client->store(buf, length);
4276
4264
TableList *table;
4277
4265
List<Item> field_list;
4279
plugin::Protocol *protocol= session->protocol;
4281
4268
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
4282
4269
item->maybe_null= 1;
4283
4270
field_list.push_back(item= new Item_int("Checksum", (int64_t) 1,
4284
4271
MY_INT64_NUM_DECIMAL_DIGITS));
4285
4272
item->maybe_null= 1;
4286
if (protocol->sendFields(&field_list))
4273
if (session->client->sendFields(&field_list))
4289
4276
/* Open one table after the other to keep lock time as short as possible. */
4297
4284
t= table->table= session->open_ltable(table, TL_READ);
4298
4285
session->clear_error(); // these errors shouldn't get client
4300
protocol->prepareForResend();
4301
protocol->store(table_name);
4287
session->client->store(table_name);
4305
4291
/* Table didn't exist */
4292
session->client->store();
4307
4293
session->clear_error();
4311
4297
if (t->file->ha_table_flags() & HA_HAS_CHECKSUM &&
4312
4298
!(check_opt->flags & T_EXTEND))
4313
protocol->store((uint64_t)t->file->checksum());
4299
session->client->store((uint64_t)t->file->checksum());
4314
4300
else if (!(t->file->ha_table_flags() & HA_HAS_CHECKSUM) &&
4315
4301
(check_opt->flags & T_QUICK))
4302
session->client->store();
4319
4305
/* calculating table's checksum */