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
00028 namespace drizzled
00029 {
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 bool need_start_waiting= false;
00037
00038 if (insert_precheck(&session(), all_tables))
00039 {
00040 return true;
00041 }
00042
00043 if (! (need_start_waiting= ! session().wait_if_global_read_lock(false, true)))
00044 {
00045 return true;
00046 }
00047
00048 DRIZZLE_INSERT_START(session().getQueryString()->c_str());
00049
00050 bool res= insert_query(&session(),
00051 all_tables,
00052 lex().field_list,
00053 lex().many_values,
00054 lex().update_list,
00055 lex().value_list,
00056 lex().duplicates,
00057 lex().ignore);
00058
00059
00060
00061
00062 session().startWaitingGlobalReadLock();
00063
00064 return res;
00065 }
00066
00067 }