187
bool buildTables(Session *session, const char *ident)
189
session->getLex()->sql_command= SQLCOM_SELECT;
191
drizzled::statement::Show *select= new statement::Show(session);
192
session->getLex()->statement= select;
194
std::string column_name= "Tables_in_";
196
util::string::const_shared_ptr schema(session->schema());
199
identifier::Schema identifier(ident);
200
column_name.append(ident);
201
session->getLex()->select_lex.db= const_cast<char *>(ident);
202
if (not plugin::StorageEngine::doesSchemaExist(identifier))
204
my_error(ER_BAD_DB_ERROR, MYF(0), ident);
206
select->setShowPredicate(ident, "");
208
else if (schema and not schema->empty())
210
column_name.append(*schema);
211
select->setShowPredicate(*schema, "");
215
my_error(ER_NO_DB_ERROR, MYF(0));
220
if (session->getLex()->wild)
222
column_name.append(" (");
223
column_name.append(session->getLex()->wild->ptr());
224
column_name.append(")");
227
if (prepare_new_schema_table(session, session->getLex(), "SHOW_TABLES"))
230
Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
231
my_field->is_autogenerated_name= false;
232
my_field->set_name(column_name.c_str(), column_name.length(), system_charset_info);
234
if (session->add_item_to_list(my_field))
237
if (session->add_order_to_list(my_field, true))
243
bool buildTemporaryTables(Session *session)
245
session->getLex()->sql_command= SQLCOM_SELECT;
247
session->getLex()->statement= new statement::Show(session);
250
if (prepare_new_schema_table(session, session->getLex(), "SHOW_TEMPORARY_TABLES"))
253
if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
256
(session->lex->current_select->with_wild)++;
261
bool buildTableStatus(Session *session, const char *ident)
263
session->getLex()->sql_command= SQLCOM_SELECT;
264
drizzled::statement::Show *select= new statement::Show(session);
265
session->getLex()->statement= select;
267
std::string column_name= "Tables_in_";
269
util::string::const_shared_ptr schema(session->schema());
272
session->getLex()->select_lex.db= const_cast<char *>(ident);
274
identifier::Schema identifier(ident);
275
if (not plugin::StorageEngine::doesSchemaExist(identifier))
277
my_error(ER_BAD_DB_ERROR, MYF(0), ident);
280
select->setShowPredicate(ident, "");
284
select->setShowPredicate(*schema, "");
288
my_error(ER_NO_DB_ERROR, MYF(0));
292
if (prepare_new_schema_table(session, session->getLex(), "SHOW_TABLE_STATUS"))
295
if (session->add_item_to_list( new Item_field(&session->lex->current_select->
300
(session->lex->current_select->with_wild)++;
187
305
bool buildCreateSchema(Session *session, LEX_STRING &ident)
189
307
session->getLex()->sql_command= SQLCOM_SELECT;