347
347
String buffer(buff, sizeof(buff), system_charset_info);
349
349
/* Only one table for now, but VIEW can involve several tables */
350
if (open_normal_and_derived_tables(session, table_list, 0))
350
if (session->open_normal_and_derived_tables(table_list, 0))
352
352
if (session->is_error())
382
382
protocol->prepareForResend();
384
384
if (table_list->schema_table)
385
protocol->store(table_list->schema_table->table_name,
386
system_charset_info);
385
protocol->store(table_list->schema_table->table_name);
388
protocol->store(table_list->table->alias, system_charset_info);
387
protocol->store(table_list->table->alias);
391
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
390
protocol->store(buffer.ptr(), buffer.length());
393
392
if (protocol->write())
425
424
protocol->prepareForResend();
426
protocol->store(dbname, strlen(dbname), system_charset_info);
427
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
425
protocol->store(dbname, strlen(dbname));
426
protocol->store(buffer.ptr(), buffer.length());
429
428
if (protocol->write())
447
if (open_normal_and_derived_tables(session, table_list, 0))
446
if (session->open_normal_and_derived_tables(table_list, 0))
449
448
table= table_list->table;
1069
1068
protocol->prepareForResend();
1070
1069
protocol->store((uint64_t) session_info->thread_id);
1071
protocol->store(session_info->user, system_charset_info);
1072
protocol->store(session_info->host, system_charset_info);
1073
protocol->store(session_info->db, system_charset_info);
1074
protocol->store(session_info->proc_info, system_charset_info);
1070
protocol->store(session_info->user);
1071
protocol->store(session_info->host);
1072
protocol->store(session_info->db);
1073
protocol->store(session_info->proc_info);
1076
1075
if (session_info->start_time)
1077
1076
protocol->store((uint32_t) (now - session_info->start_time));
1079
1078
protocol->store();
1081
protocol->store(session_info->state_info, system_charset_info);
1082
protocol->store(session_info->query, system_charset_info);
1080
protocol->store(session_info->state_info);
1081
protocol->store(session_info->query);
1084
1083
if (protocol->write())
1085
1084
break; /* purecov: inspected */
2158
2157
SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
2160
2159
lex->sql_command= SQLCOM_SHOW_FIELDS;
2161
res= open_normal_and_derived_tables(session, show_table_list,
2162
DRIZZLE_LOCK_IGNORE_FLUSH);
2160
res= session->open_normal_and_derived_tables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);
2163
2161
lex->sql_command= save_sql_command;
2165
2163
get_all_tables() returns 1 on failure and 0 on success thus
2309
2307
table_list.table_name= table_name->str;
2310
2308
table_list.db= db_name->str;
2312
key_length= create_table_def_key(key, &table_list);
2310
key_length= table_list.create_table_def_key(key);
2313
2311
pthread_mutex_lock(&LOCK_open); /* Locking to get table share when filling schema table from FRM */
2314
2312
share= get_table_share(session, &table_list, key,
2315
2313
key_length, 0, &error);
2517
2515
lex->sql_command= SQLCOM_SHOW_FIELDS;
2518
2516
show_table_list->i_s_requested_object=
2519
2517
schema_table->i_s_requested_object;
2520
res= open_normal_and_derived_tables(session, show_table_list,
2521
DRIZZLE_LOCK_IGNORE_FLUSH);
2518
res= session->open_normal_and_derived_tables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);
2522
2519
lex->sql_command= save_sql_command;
2524
XXX: show_table_list has a flag i_is_requested,
2525
and when it's set, open_normal_and_derived_tables()
2526
can return an error without setting an error message
2527
in Session, which is a hack. This is why we have to
2528
check for res, then for session->is_error() only then
2529
for session->main_da.sql_errno().
2521
XXX-> show_table_list has a flag i_is_requested,
2522
and when it's set, open_normal_and_derived_tables()
2523
can return an error without setting an error message
2524
in Session, which is a hack. This is why we have to
2525
check for res, then for session->is_error() only then
2526
for session->main_da.sql_errno().
2531
2528
if (res && session->is_error() &&
2532
2529
session->main_da.sql_errno() == ER_NO_SUCH_TABLE)