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/statement/replace.h>
00026
00027 namespace drizzled
00028 {
00029
00030 bool statement::Replace::execute()
00031 {
00032 TableList *first_table= (TableList *) lex().select_lex.table_list.first;
00033 TableList *all_tables= lex().query_tables;
00034 assert(first_table == all_tables && first_table != 0);
00035
00036 if (insert_precheck(&session(), all_tables))
00037 {
00038 return true;
00039 }
00040
00041 if (session().wait_if_global_read_lock(false, true))
00042 {
00043 return true;
00044 }
00045
00046 bool res= insert_query(&session(),
00047 all_tables,
00048 lex().field_list,
00049 lex().many_values,
00050 lex().update_list,
00051 lex().value_list,
00052 lex().duplicates,
00053 lex().ignore);
00054
00055
00056
00057
00058 session().startWaitingGlobalReadLock();
00059
00060 return res;
00061 }
00062
00063 }
00064