~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/replace_select.cc

  • Committer: Lee Bieber
  • Date: 2011-03-13 16:37:38 UTC
  • mfrom: (2227.4.18 session2)
  • Revision ID: kalebral@gmail.com-20110313163738-7ti21zk40o2xi3ew
Merge Olaf - Refactor Session

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
  select_result *sel_result= NULL;
39
39
  bool res;
40
40
 
41
 
  if (insert_precheck(getSession(), all_tables))
 
41
  if (insert_precheck(&session(), all_tables))
42
42
  {
43
43
    return true;
44
44
  }
48
48
 
49
49
  unit->set_limit(select_lex);
50
50
 
51
 
  if (getSession()->wait_if_global_read_lock(false, true))
 
51
  if (session().wait_if_global_read_lock(false, true))
52
52
  {
53
53
    return true;
54
54
  }
55
55
 
56
 
  if (! (res= getSession()->openTablesLock(all_tables)))
 
56
  if (! (res= session().openTablesLock(all_tables)))
57
57
  {
58
58
    /* Skip first table, which is the table we are inserting in */
59
59
    TableList *second_table= first_table->next_local;
60
60
    select_lex->table_list.first= (unsigned char*) second_table;
61
61
    select_lex->context.table_list=
62
62
      select_lex->context.first_name_resolution_table= second_table;
63
 
    res= insert_select_prepare(getSession());
 
63
    res= insert_select_prepare(&session());
64
64
    if (! res && (sel_result= new select_insert(first_table,
65
65
                                                first_table->table,
66
66
                                                &lex().field_list,
69
69
                                                lex().duplicates,
70
70
                                                lex().ignore)))
71
71
    {
72
 
      res= handle_select(getSession(),
 
72
      res= handle_select(&session(),
73
73
                         &lex(),
74
74
                         sel_result,
75
75
                         OPTION_SETUP_TABLES_DONE);
80
80
         the unlock procedure.
81
81
       */
82
82
      if (first_table->lock_type == TL_WRITE_CONCURRENT_INSERT &&
83
 
          getSession()->lock)
 
83
          session().lock)
84
84
      {
85
85
        /* INSERT ... SELECT should invalidate only the very first table */
86
86
        TableList *save_table= first_table->next_local;
97
97
     Release the protection against the global read lock and wake
98
98
     everyone, who might want to set a global read lock.
99
99
   */
100
 
  getSession()->startWaitingGlobalReadLock();
 
100
  session().startWaitingGlobalReadLock();
101
101
 
102
102
  return res;
103
103
}