~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/insert.cc

Merge Monty - Updates to pandora-build to support features of gcc 4.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/lock.h>
24
24
#include <drizzled/session.h>
25
25
#include <drizzled/probes.h>
26
26
#include <drizzled/statement/insert.h>
27
 
#include <drizzled/sql_lex.h>
28
27
 
29
 
namespace drizzled {
 
28
namespace drizzled
 
29
{
30
30
 
31
31
bool statement::Insert::execute()
32
32
{
33
 
  TableList *first_table= (TableList *) lex().select_lex.table_list.first;
34
 
  TableList *all_tables= lex().query_tables;
 
33
  TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
 
34
  TableList *all_tables= session->lex->query_tables;
35
35
  assert(first_table == all_tables && first_table != 0);
36
 
 
37
 
  if (insert_precheck(&session(), all_tables))
38
 
  {
39
 
    return true;
40
 
  }
41
 
 
42
 
  if (session().wait_if_global_read_lock(false, true))
43
 
  {
44
 
    return true;
45
 
  }
46
 
 
47
 
  DRIZZLE_INSERT_START(session().getQueryString()->c_str());
48
 
 
49
 
  bool res= insert_query(&session(),
 
36
  bool need_start_waiting= false;
 
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= mysql_insert(session,
50
51
                         all_tables,
51
 
                         lex().field_list,
52
 
                         lex().many_values,
53
 
                         lex().update_list,
54
 
                         lex().value_list,
55
 
                         lex().duplicates,
56
 
                         lex().ignore);
 
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);
57
58
  /*
58
59
     Release the protection against the global read lock and wake
59
60
     everyone, who might want to set a global read lock.
60
61
   */
61
 
  session().startWaitingGlobalReadLock();
 
62
  session->startWaitingGlobalReadLock();
62
63
 
63
64
  return res;
64
65
}