~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/insert_select.cc

  • Committer: Monty Taylor
  • Date: 2009-09-22 23:50:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20090922235012-i0a3bs91f6krqduc
Fixed multi_malloc.h include guard.
Added include guard checking script.

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 <drizzled/server_includes.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/lock.h>
24
24
#include <drizzled/session.h>
25
 
#include <drizzled/probes.h>
26
25
#include <drizzled/statement/insert_select.h>
27
26
 
28
 
namespace drizzled
29
 
{
 
27
using namespace drizzled;
30
28
 
31
29
bool statement::InsertSelect::execute()
32
30
{
49
47
 
50
48
  unit->set_limit(select_lex);
51
49
 
52
 
  if (! (need_start_waiting= not session->wait_if_global_read_lock(false, true)))
 
50
  if (! (need_start_waiting= ! wait_if_global_read_lock(session, 0, 1)))
53
51
  {
54
52
    return true;
55
53
  }
56
54
 
57
55
  if (! (res= session->openTablesLock(all_tables)))
58
56
  {
59
 
    DRIZZLE_INSERT_SELECT_START(session->getQueryString()->c_str());
60
57
    /* Skip first table, which is the table we are inserting in */
61
58
    TableList *second_table= first_table->next_local;
62
59
    select_lex->table_list.first= (unsigned char*) second_table;
75
72
                         session->lex, 
76
73
                         sel_result, 
77
74
                         OPTION_SETUP_TABLES_DONE);
78
 
 
79
75
      /*
80
76
         Invalidate the table in the query cache if something changed
81
77
         after unlocking when changes become visible.
100
96
     Release the protection against the global read lock and wake
101
97
     everyone, who might want to set a global read lock.
102
98
   */
103
 
  session->startWaitingGlobalReadLock();
 
99
  start_waiting_global_read_lock(session);
104
100
 
105
101
  return res;
106
102
}
107
 
 
108
 
} /* namespace drizzled */