~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/insert.cc

  • Committer: Brian Aker
  • Date: 2011-01-22 18:52:16 UTC
  • mfrom: (2098.4.1 catalogs)
  • Revision ID: brian@tangent.org-20110122185216-18and6vncipd7x72
Session encapsulation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
bool statement::Insert::execute()
32
32
{
33
 
  TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
34
 
  TableList *all_tables= session->lex->query_tables;
 
33
  TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
 
34
  TableList *all_tables= getSession()->lex->query_tables;
35
35
  assert(first_table == all_tables && first_table != 0);
36
36
  bool need_start_waiting= false;
37
37
 
38
 
  if (insert_precheck(session, all_tables))
39
 
  {
40
 
    return true;
41
 
  }
42
 
 
43
 
  if (! (need_start_waiting= ! session->wait_if_global_read_lock(false, true)))
44
 
  {
45
 
    return true;
46
 
  }
47
 
 
48
 
  DRIZZLE_INSERT_START(session->getQueryString()->c_str());
49
 
 
50
 
  bool res= insert_query(session,
 
38
  if (insert_precheck(getSession(), all_tables))
 
39
  {
 
40
    return true;
 
41
  }
 
42
 
 
43
  if (! (need_start_waiting= ! getSession()->wait_if_global_read_lock(false, true)))
 
44
  {
 
45
    return true;
 
46
  }
 
47
 
 
48
  DRIZZLE_INSERT_START(getSession()->getQueryString()->c_str());
 
49
 
 
50
  bool res= insert_query(getSession(),
51
51
                         all_tables,
52
 
                         session->lex->field_list,
53
 
                         session->lex->many_values,
54
 
                         session->lex->update_list,
55
 
                         session->lex->value_list,
56
 
                         session->lex->duplicates,
57
 
                         session->lex->ignore);
 
52
                         getSession()->lex->field_list,
 
53
                         getSession()->lex->many_values,
 
54
                         getSession()->lex->update_list,
 
55
                         getSession()->lex->value_list,
 
56
                         getSession()->lex->duplicates,
 
57
                         getSession()->lex->ignore);
58
58
  /*
59
59
     Release the protection against the global read lock and wake
60
60
     everyone, who might want to set a global read lock.
61
61
   */
62
 
  session->startWaitingGlobalReadLock();
 
62
  getSession()->startWaitingGlobalReadLock();
63
63
 
64
64
  return res;
65
65
}