18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/lock.h>
24
24
#include <drizzled/session.h>
25
25
#include <drizzled/probes.h>
26
26
#include <drizzled/statement/insert.h>
27
#include <drizzled/sql_lex.h>
31
31
bool statement::Insert::execute()
33
TableList *first_table= (TableList *) lex().select_lex.table_list.first;
34
TableList *all_tables= lex().query_tables;
33
TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
34
TableList *all_tables= getSession()->lex->query_tables;
35
35
assert(first_table == all_tables && first_table != 0);
36
36
bool need_start_waiting= false;
38
if (insert_precheck(&session(), all_tables))
43
if (! (need_start_waiting= ! session().wait_if_global_read_lock(false, true)))
48
DRIZZLE_INSERT_START(session().getQueryString()->c_str());
50
bool res= insert_query(&session(),
38
if (insert_precheck(getSession(), all_tables))
43
if (! (need_start_waiting= ! getSession()->wait_if_global_read_lock(false, true)))
48
DRIZZLE_INSERT_START(getSession()->getQueryString()->c_str());
50
bool res= insert_query(getSession(),
52
getSession()->lex->field_list,
53
getSession()->lex->many_values,
54
getSession()->lex->update_list,
55
getSession()->lex->value_list,
56
getSession()->lex->duplicates,
57
getSession()->lex->ignore);
59
59
Release the protection against the global read lock and wake
60
60
everyone, who might want to set a global read lock.
62
session().startWaitingGlobalReadLock();
62
getSession()->startWaitingGlobalReadLock();