4828
4827
DATABASES show_wild
4831
lex->sql_command= SQLCOM_SHOW_DATABASES;
4830
lex->sql_command= SQLCOM_SELECT;
4832
4831
lex->statement=
4833
4832
new(std::nothrow) statement::Select(YYSession);
4834
4833
if (lex->statement == NULL)
4835
4834
DRIZZLE_YYABORT;
4836
if (prepare_schema_table(YYSession, lex, 0, "SCHEMATA"))
4836
Session *session= YYSession;
4838
std::string column_name= "Database";
4841
column_name.append(" (");
4842
column_name.append(Lex->wild->c_str());
4843
column_name.append(")");
4846
if (Lex->current_select->where)
4848
if (prepare_new_schema_table(YYSession, lex, "SCHEMAS"))
4853
if (prepare_new_schema_table(YYSession, lex, "SCHEMA_NAMES"))
4857
Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
4858
my_field->is_autogenerated_name= false;
4859
my_field->set_name(column_name.c_str(), column_name.length(), system_charset_info);
4861
if (session->add_item_to_list(my_field))
4837
4862
DRIZZLE_YYABORT;
4839
| opt_full TABLES opt_db show_wild
4864
| TABLES opt_db show_wild
4842
lex->sql_command= SQLCOM_SHOW_TABLES;
4867
lex->sql_command= SQLCOM_SELECT;
4843
4868
lex->statement=
4844
4869
new(std::nothrow) statement::Select(YYSession);
4845
4870
if (lex->statement == NULL)
4846
4871
DRIZZLE_YYABORT;
4847
lex->select_lex.db= $3;
4848
if (prepare_schema_table(YYSession, lex, 0, "TABLE_NAMES"))
4873
Session *session= YYSession;
4875
std::string column_name= "Tables_in_";
4879
message::Schema schema_message;
4880
column_name.append($2);
4881
lex->select_lex.db= $2;
4882
if (not plugin::StorageEngine::getSchemaDefinition($2, schema_message))
4884
my_error(ER_BAD_DB_ERROR, MYF(0), $2);
4889
column_name.append(session->db);
4894
column_name.append(" (");
4895
column_name.append(Lex->wild->c_str());
4896
column_name.append(")");
4899
if (Lex->current_select->where)
4901
if (prepare_new_schema_table(YYSession, lex, "TABLES"))
4906
if (prepare_new_schema_table(YYSession, lex, "LOCAL_TABLE_NAMES"))
4910
Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
4911
my_field->is_autogenerated_name= false;
4912
my_field->set_name(column_name.c_str(), column_name.length(), system_charset_info);
4914
if (session->add_item_to_list(my_field))
4849
4915
DRIZZLE_YYABORT;
4851
4917
| TABLE_SYM STATUS_SYM opt_db show_wild
4854
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
4920
lex->sql_command= SQLCOM_SELECT;
4855
4921
lex->statement=
4856
4922
new(std::nothrow) statement::Select(YYSession);
4857
4923
if (lex->statement == NULL)
4858
4924
DRIZZLE_YYABORT;
4859
lex->select_lex.db= $3;
4860
if (prepare_schema_table(YYSession, lex, 0, "TABLES"))
4926
Session *session= YYSession;
4928
std::string column_name= "Tables_in_";
4932
message::Schema schema_message;
4933
lex->select_lex.db= $3;
4935
if (not plugin::StorageEngine::getSchemaDefinition($3, schema_message))
4937
my_error(ER_BAD_DB_ERROR, MYF(0), $3);
4941
if (prepare_new_schema_table(session, lex, "LOCAL_TABLE_STATUS"))
4944
if (session->add_item_to_list( new Item_field(&session->lex->current_select->
4948
(session->lex->current_select->with_wild)++;
4863
| OPEN_SYM TABLES opt_db show_wild
4866
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
4868
new(std::nothrow) statement::Select(YYSession);
4869
if (lex->statement == NULL)
4871
lex->select_lex.db= $3;
4872
if (prepare_schema_table(YYSession, lex, 0, "OPEN_TABLES"))
4875
| ENGINE_SYM ident_or_text STATUS_SYM /* This should either go... well it should go */
4877
Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
4879
new(std::nothrow) statement::ShowEngineStatus(YYSession, $2.str);
4880
if (Lex->statement == NULL)
4883
| opt_full COLUMNS from_or_in table_ident opt_db show_wild
4950
| COLUMNS from_or_in table_ident opt_db show_wild
4886
4953
lex->sql_command= SQLCOM_SHOW_FIELDS;