18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/probes.h>
26
26
#include <drizzled/statement/delete.h>
27
#include <drizzled/sql_lex.h>
32
31
bool statement::Delete::execute()
34
DRIZZLE_DELETE_START(session().getQueryString()->c_str());
35
TableList *first_table= (TableList *) lex().select_lex.table_list.first;
36
TableList *all_tables= lex().query_tables;
37
Select_Lex *select_lex= &lex().select_lex;
38
Select_Lex_Unit *unit= &lex().unit;
33
DRIZZLE_DELETE_START(getSession()->getQueryString()->c_str());
34
TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
35
TableList *all_tables= getSession()->lex->query_tables;
36
Select_Lex *select_lex= &getSession()->lex->select_lex;
37
Select_Lex_Unit *unit= &getSession()->lex->unit;
39
38
assert(first_table == all_tables && first_table != 0);
40
39
assert(select_lex->offset_limit == 0);
41
40
unit->set_limit(select_lex);
42
41
bool need_start_waiting= false;
44
if (! (need_start_waiting= not session().wait_if_global_read_lock(0, 1)))
43
if (! (need_start_waiting= not getSession()->wait_if_global_read_lock(0, 1)))
49
bool res= delete_query(&session(), all_tables, select_lex->where,
48
bool res= delete_query(getSession(), all_tables, select_lex->where,
50
49
&select_lex->order_list,
51
50
unit->select_limit_cnt, select_lex->options,
54
53
Release the protection against the global read lock and wake
55
54
everyone, who might want to set a global read lock.
57
session().startWaitingGlobalReadLock();
56
getSession()->startWaitingGlobalReadLock();