00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022 #include <drizzled/show.h>
00023 #include <drizzled/lock.h>
00024 #include <drizzled/session.h>
00025 #include <drizzled/probes.h>
00026 #include <drizzled/statement/insert.h>
00027 #include <drizzled/sql_lex.h>
00028
00029 namespace drizzled {
00030
00031 bool statement::Insert::execute()
00032 {
00033 TableList *first_table= (TableList *) lex().select_lex.table_list.first;
00034 TableList *all_tables= lex().query_tables;
00035 assert(first_table == all_tables && first_table != 0);
00036
00037 if (insert_precheck(&session(), all_tables))
00038 {
00039 return true;
00040 }
00041
00042 if (session().wait_if_global_read_lock(false, true))
00043 {
00044 return true;
00045 }
00046
00047 DRIZZLE_INSERT_START(session().getQueryString()->c_str());
00048
00049 bool res= insert_query(&session(),
00050 all_tables,
00051 lex().field_list,
00052 lex().many_values,
00053 lex().update_list,
00054 lex().value_list,
00055 lex().duplicates,
00056 lex().ignore);
00057
00058
00059
00060
00061 session().startWaitingGlobalReadLock();
00062
00063 return res;
00064 }
00065
00066 }