~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/insert_select.cc

  • Committer: Mark Atwood
  • Date: 2011-07-13 22:28:29 UTC
  • mfrom: (2318.7.25 refactor1)
  • Revision ID: me@mark.atwood.name-20110713222829-sswp061b5ts7tc1k
mergeĀ lp:~olafvdspek/drizzle/refactor1

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
  TableList *all_tables= lex().query_tables;
37
37
  assert(first_table == all_tables && first_table != 0);
38
38
  Select_Lex *select_lex= &lex().select_lex;
39
 
  Select_Lex_Unit *unit= &lex().unit;
40
 
  select_result *sel_result= NULL;
41
 
  bool res= false;
42
 
  bool need_start_waiting= false;
43
39
 
44
40
  if (insert_precheck(&session(), all_tables))
45
41
  {
49
45
  /* Don't unlock tables until command is written to binary log */
50
46
  select_lex->options|= SELECT_NO_UNLOCK;
51
47
 
52
 
  unit->set_limit(select_lex);
 
48
  lex().unit.set_limit(select_lex);
53
49
 
54
 
  if (! (need_start_waiting= not session().wait_if_global_read_lock(false, true)))
 
50
  if (session().wait_if_global_read_lock(false, true))
55
51
  {
56
52
    return true;
57
53
  }
58
54
 
 
55
  bool res;
59
56
  if (! (res= session().openTablesLock(all_tables)))
60
57
  {
61
58
    DRIZZLE_INSERT_SELECT_START(session().getQueryString()->c_str());
66
63
    res= insert_select_prepare(&session());
67
64
    if (not res)
68
65
    {
69
 
      sel_result= new select_insert(first_table, first_table->table, &lex().field_list, &lex().update_list, &lex().value_list, 
70
 
        lex().duplicates, lex().ignore);
71
 
      res= handle_select(&session(), &lex(), sel_result, OPTION_SETUP_TABLES_DONE);
 
66
      select_insert sel_result(first_table, first_table->table, &lex().field_list, &lex().update_list, &lex().value_list, lex().duplicates, lex().ignore);
 
67
      res= handle_select(&session(), &lex(), &sel_result, OPTION_SETUP_TABLES_DONE);
72
68
 
73
69
      /*
74
70
         Invalidate the table in the query cache if something changed
83
79
        first_table->next_local= 0;
84
80
        first_table->next_local= save_table;
85
81
      }
86
 
      delete sel_result;
87
82
    }
88
83
    /* revert changes for SP */
89
84
    select_lex->table_list.first= (unsigned char*) first_table;