4869
4869
/* SHOW COLUMNS FROM table_name */
4870
4870
| COLUMNS from_or_in table_ident opt_db show_wild
4872
Lex->sql_command= SQLCOM_SELECT;
4874
drizzled::statement::Show *select= new statement::Show(YYSession);
4875
Lex->statement= select;
4877
util::string::const_shared_ptr schema(YYSession->schema());
4880
select->setShowPredicate($4, $3->table.str);
4882
else if ($3->db.str)
4884
select->setShowPredicate($3->db.str, $3->table.str);
4888
select->setShowPredicate(*schema, $3->table.str);
4892
my_error(ER_NO_DB_ERROR, MYF(0));
4897
drizzled::identifier::Table identifier(select->getShowSchema().c_str(), $3->table.str);
4898
if (not plugin::StorageEngine::doesTableExist(*YYSession, identifier))
4900
my_error(ER_NO_SUCH_TABLE, MYF(0),
4901
select->getShowSchema().c_str(),
4906
if (prepare_new_schema_table(YYSession, Lex, "SHOW_COLUMNS"))
4909
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
4913
(YYSession->lex->current_select->with_wild)++;
4872
if (not show::buildColumns(YYSession, $4, $3))
4916
4875
/* SHOW INDEXES from table */
4917
4876
| keys_or_index from_or_in table_ident opt_db where_clause
4919
Lex->sql_command= SQLCOM_SELECT;
4920
drizzled::statement::Show *select= new statement::Show(YYSession);
4921
Lex->statement= select;
4923
util::string::const_shared_ptr schema(YYSession->schema());
4926
select->setShowPredicate($4, $3->table.str);
4928
else if ($3->db.str)
4930
select->setShowPredicate($3->db.str, $3->table.str);
4934
select->setShowPredicate(*schema, $3->table.str);
4938
my_error(ER_NO_DB_ERROR, MYF(0));
4943
drizzled::identifier::Table identifier(select->getShowSchema().c_str(), $3->table.str);
4944
if (not plugin::StorageEngine::doesTableExist(*YYSession, identifier))
4946
my_error(ER_NO_SUCH_TABLE, MYF(0),
4947
select->getShowSchema().c_str(),
4952
if (prepare_new_schema_table(YYSession, Lex, "SHOW_INDEXES"))
4955
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
4959
(YYSession->lex->current_select->with_wild)++;
4878
if (not show::buildIndex(YYSession, $4, $3))
4961
4881
| COUNT_SYM '(' '*' ')' WARNINGS
4963
4883
(void) create_select_for_variable("warning_count");
4979
4899
Lex->statement= new statement::ShowErrors(YYSession);
4981
4901
| opt_var_type STATUS_SYM show_wild
4983
Lex->sql_command= SQLCOM_SELECT;
4984
Lex->statement= new statement::Show(YYSession);
4986
if ($1 == OPT_GLOBAL)
4988
if (prepare_new_schema_table(YYSession, Lex, "GLOBAL_STATUS"))
4993
if (prepare_new_schema_table(YYSession, Lex, "SESSION_STATUS"))
4997
std::string key("Variable_name");
4998
std::string value("Value");
5000
Item_field *my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "VARIABLE_NAME");
5001
my_field->is_autogenerated_name= false;
5002
my_field->set_name(key.c_str(), key.length(), system_charset_info);
5004
if (YYSession->add_item_to_list(my_field))
5007
my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "VARIABLE_VALUE");
5008
my_field->is_autogenerated_name= false;
5009
my_field->set_name(value.c_str(), value.length(), system_charset_info);
5011
if (YYSession->add_item_to_list(my_field))
4903
if (not show::buildStatus(YYSession, $1))
5014
4906
| CREATE TABLE_SYM table_ident
5016
Lex->sql_command= SQLCOM_SELECT;
5017
statement::Show *select= new statement::Show(YYSession);
5018
Lex->statement= select;
5020
if (Lex->statement == NULL)
5023
if (prepare_new_schema_table(YYSession, Lex, "TABLE_SQL_DEFINITION"))
5026
util::string::const_shared_ptr schema(YYSession->schema());
5029
select->setShowPredicate($3->db.str, $3->table.str);
5033
select->setShowPredicate(*schema, $3->table.str);
5037
my_error(ER_NO_DB_ERROR, MYF(0));
5041
std::string key("Table");
5042
std::string value("Create Table");
5044
Item_field *my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "TABLE_NAME");
5045
my_field->is_autogenerated_name= false;
5046
my_field->set_name(key.c_str(), key.length(), system_charset_info);
5048
if (YYSession->add_item_to_list(my_field))
5051
my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
5052
my_field->is_autogenerated_name= false;
5053
my_field->set_name(value.c_str(), value.length(), system_charset_info);
5055
if (YYSession->add_item_to_list(my_field))
4908
if (not show::buildCreateTable(YYSession, $3))
5058
4911
| PROCESSLIST_SYM
5061
Lex->sql_command= SQLCOM_SELECT;
5062
Lex->statement= new statement::Show(YYSession);
5064
if (prepare_new_schema_table(YYSession, Lex, "PROCESSLIST"))
5067
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
5071
(YYSession->lex->current_select->with_wild)++;
4913
if (not show::buildProcesslist(YYSession))
5074
4916
| opt_var_type VARIABLES show_wild
5076
4918
if (not show::buildVariables(YYSession, $1))
5078
4919
DRIZZLE_YYABORT;
5081
4921
| CREATE DATABASE opt_if_not_exists ident
5083
4923
if (not show::buildCreateSchema(YYSession, $4))
5085
4924
DRIZZLE_YYABORT;