21
21
#include <drizzled/server_includes.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
#include <drizzled/lock.h>
24
25
#include <drizzled/statement/drop_table.h>
37
tables List of tables to delete
38
if_exists If 1, don't give error if one table doesn't exists
41
Will delete all tables that can be deleted and give a compact error
42
messages for tables that could not be deleted.
43
If a table is in use, we will wait for all users to free the table
46
Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set, but
47
not if under LOCK TABLES.
50
false OK. In this case ok packet is sent to user
55
static bool mysql_rm_table(Session *session, TableList *tables, bool if_exists, bool drop_temporary)
57
bool error, need_start_waiting= false;
59
if (tables && tables->schema_table)
61
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.c_str());
65
/* mark for close and remove all cached entries */
69
if (!(need_start_waiting= !wait_if_global_read_lock(session, false, true)))
74
Acquire LOCK_open after wait_if_global_read_lock(). If we would hold
75
LOCK_open during wait_if_global_read_lock(), other threads could not
76
close their tables. This would make a pretty deadlock.
78
error= mysql_rm_table_part2(session, tables, if_exists, drop_temporary);
80
if (need_start_waiting)
81
start_waiting_global_read_lock(session);
29
91
bool statement::DropTable::execute()
31
93
TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;