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>
31
32
bool statement::Delete::execute()
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;
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;
38
39
assert(first_table == all_tables && first_table != 0);
39
40
assert(select_lex->offset_limit == 0);
40
41
unit->set_limit(select_lex);
41
42
bool need_start_waiting= false;
43
if (! (need_start_waiting= not getSession()->wait_if_global_read_lock(0, 1)))
44
if (! (need_start_waiting= not session().wait_if_global_read_lock(0, 1)))
48
bool res= delete_query(getSession(), all_tables, select_lex->where,
49
bool res= delete_query(&session(), all_tables, select_lex->where,
49
50
&select_lex->order_list,
50
51
unit->select_limit_cnt, select_lex->options,
53
54
Release the protection against the global read lock and wake
54
55
everyone, who might want to set a global read lock.
56
getSession()->startWaitingGlobalReadLock();
57
session().startWaitingGlobalReadLock();