4822
4820
| COLUMNS from_or_in table_ident opt_db show_wild
4825
lex->sql_command= SQLCOM_SHOW_FIELDS;
4827
new(std::nothrow) statement::Select(YYSession);
4828
if (lex->statement == NULL)
4832
if (prepare_schema_table(YYSession, lex, $3, "OLD_COLUMNS"))
4822
Item_field *my_field;
4824
Session *session= YYSession;
4825
statement::Select *select;
4827
lex->sql_command= SQLCOM_SELECT;
4829
select= new(std::nothrow) statement::Select(session);
4831
lex->statement= select;
4833
if (lex->statement == NULL)
4837
select->setShowPredicate($4, $3->table.str);
4838
else if ($3->db.str)
4839
select->setShowPredicate($3->db.str, $3->table.str);
4841
select->setShowPredicate(session->db, $3->table.str);
4844
drizzled::TableIdentifier identifier(select->getShowSchema().c_str(), $3->table.str);
4845
if (plugin::StorageEngine::getTableDefinition(*session, identifier) != EEXIST)
4847
my_error(ER_NO_SUCH_TABLE, MYF(0),
4848
select->getShowSchema().c_str(),
4853
if (prepare_new_schema_table(session, lex, "COLUMNS"))
4856
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_NAME");
4857
my_field->is_autogenerated_name= false;
4858
my_field->set_name("Field");
4859
if (session->add_item_to_list(my_field))
4862
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "DATA_TYPE");
4863
my_field->is_autogenerated_name= false;
4864
my_field->set_name("Type");
4865
if (session->add_item_to_list(my_field))
4868
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "IS_NULLABLE");
4869
my_field->is_autogenerated_name= false;
4870
my_field->set_name("Null");
4871
if (session->add_item_to_list(my_field))
4874
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT");
4875
my_field->is_autogenerated_name= false;
4876
my_field->set_name("Default");
4877
if (session->add_item_to_list(my_field))
4880
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT_IS_NULL");
4881
my_field->is_autogenerated_name= false;
4882
my_field->set_name("Default is NULL");
4883
if (session->add_item_to_list(my_field))
4886
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT_UPDATE");
4887
my_field->is_autogenerated_name= false;
4888
my_field->set_name("On Update");
4889
if (session->add_item_to_list(my_field))
4835
4892
| keys_or_index from_or_in table_ident opt_db where_clause
4838
lex->sql_command= SQLCOM_SHOW_KEYS;
4839
lex->statement= new(std::nothrow) statement::Select(YYSession);
4840
if (lex->statement == NULL)
4844
if (prepare_schema_table(YYSession, lex, $3, "OLD_STATISTICS"))
4894
Item_field *my_field;
4896
Session *session= YYSession;
4897
statement::Select *select;
4899
lex->sql_command= SQLCOM_SELECT;
4901
select= new(std::nothrow) statement::Select(session);
4903
lex->statement= select;
4905
if (lex->statement == NULL)
4909
select->setShowPredicate($4, $3->table.str);
4910
else if ($3->db.str)
4911
select->setShowPredicate($3->db.str, $3->table.str);
4913
select->setShowPredicate(session->db, $3->table.str);
4916
drizzled::TableIdentifier identifier(select->getShowSchema().c_str(), $3->table.str);
4917
if (plugin::StorageEngine::getTableDefinition(*session, identifier) != EEXIST)
4919
my_error(ER_NO_SUCH_TABLE, MYF(0),
4920
select->getShowSchema().c_str(),
4925
if (prepare_new_schema_table(session, lex, "INDEX_PARTS"))
4928
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
4929
my_field->is_autogenerated_name= false;
4930
my_field->set_name("Table");
4931
if (session->add_item_to_list(my_field))
4935
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "IS_UNIQUE");
4936
my_field->is_autogenerated_name= false;
4937
my_field->set_name("Non_unique");
4938
if (session->add_item_to_list(my_field))
4942
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "INDEX_NAME");
4943
my_field->is_autogenerated_name= false;
4944
my_field->set_name("Key_name");
4945
if (session->add_item_to_list(my_field))
4948
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SEQUENCE_IN_INDEX");
4949
my_field->is_autogenerated_name= false;
4950
my_field->set_name("Seq_in_index");
4951
if (session->add_item_to_list(my_field))
4954
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_NAME");
4955
my_field->is_autogenerated_name= false;
4956
my_field->set_name("Column_name");
4957
if (session->add_item_to_list(my_field))
4847
4960
| COUNT_SYM '(' '*' ')' WARNINGS
5027
5140
describe_command table_ident
5142
Item_field *my_field;
5143
Session *session= YYSession;
5144
statement::Select *select;
5030
5146
lex->lock_option= TL_READ;
5031
5147
mysql_init_select(lex);
5032
5148
lex->current_select->parsing_place= SELECT_LIST;
5033
lex->sql_command= SQLCOM_SHOW_FIELDS;
5034
lex->statement= new(std::nothrow) statement::Select(YYSession);
5149
lex->sql_command= SQLCOM_SELECT;
5150
select= new(std::nothrow) statement::Select(session);
5151
lex->statement= select;
5035
5152
if (lex->statement == NULL)
5036
5153
DRIZZLE_YYABORT;
5037
5154
lex->select_lex.db= 0;
5038
if (prepare_schema_table(YYSession, lex, $2, "OLD_COLUMNS"))
5157
select->setShowPredicate($2->db.str, $2->table.str);
5159
select->setShowPredicate(session->db, $2->table.str);
5162
drizzled::TableIdentifier identifier(select->getShowSchema().c_str(), $2->table.str);
5163
if (plugin::StorageEngine::getTableDefinition(*session, identifier) != EEXIST)
5165
my_error(ER_NO_SUCH_TABLE, MYF(0),
5166
select->getShowSchema().c_str(),
5171
if (prepare_new_schema_table(session, lex, "COLUMNS"))
5174
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_NAME");
5175
my_field->is_autogenerated_name= false;
5176
my_field->set_name("Field");
5177
if (session->add_item_to_list(my_field))
5180
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "DATA_TYPE");
5181
my_field->is_autogenerated_name= false;
5182
my_field->set_name("Type");
5183
if (session->add_item_to_list(my_field))
5186
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "IS_NULLABLE");
5187
my_field->is_autogenerated_name= false;
5188
my_field->set_name("Null");
5189
if (session->add_item_to_list(my_field))
5192
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT");
5193
my_field->is_autogenerated_name= false;
5194
my_field->set_name("Default");
5195
if (session->add_item_to_list(my_field))
5198
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT_IS_NULL");
5199
my_field->is_autogenerated_name= false;
5200
my_field->set_name("Default is NULL");
5201
if (session->add_item_to_list(my_field))
5204
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "COLUMN_DEFAULT_UPDATE");
5205
my_field->is_autogenerated_name= false;
5206
my_field->set_name("On Update");
5207
if (session->add_item_to_list(my_field))
5041
5210
opt_describe_column {}
5042
5211
| describe_command opt_extended_describe