~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/execute.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "drizzled/statement/execute.h"
24
24
#include "drizzled/session.h"
 
25
#include "drizzled/execute.h"
25
26
#include "drizzled/user_var_entry.h"
26
27
#include "drizzled/plugin/listen.h"
27
28
#include "drizzled/plugin/client.h"
114
115
 
115
116
  if (is_concurrent)
116
117
  {
117
 
    boost_thread_shared_ptr thread;
118
 
 
119
 
    if (getSession()->isConcurrentExecuteAllowed())
120
 
    {
121
 
      plugin::client::Concurrent *client= new plugin::client::Concurrent;
122
 
      std::string execution_string(to_execute.str, to_execute.length);
123
 
      client->pushSQL(execution_string);
124
 
      Session::shared_ptr new_session(new Session(client));
125
 
 
126
 
      // We set the current schema.  @todo do the same with catalog
127
 
      if (not getSession()->getSchema().empty())
128
 
        new_session->set_db(getSession()->getSchema());
129
 
 
130
 
      new_session->setConcurrentExecute(false);
131
 
 
132
 
      // Overwrite the context in the next session, with what we have in our
133
 
      // session. Eventually we will allow someone to change the effective
134
 
      // user.
135
 
      new_session->getSecurityContext()= getSession()->getSecurityContext();
136
 
 
137
 
      if (Session::schedule(new_session))
138
 
      {
139
 
        Session::unlink(new_session);
140
 
      }
141
 
      else if (should_wait)
142
 
      {
143
 
        thread= new_session->getThread();
144
 
      }
145
 
    }
146
 
    else
 
118
    if (not getSession()->isConcurrentExecuteAllowed())
147
119
    {
148
120
      my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
149
121
      return false;
150
122
    }
151
123
 
152
 
    if (should_wait && thread && thread->joinable())
153
 
    {
154
 
      // We want to make sure that we can be killed
155
 
      boost::this_thread::restore_interruption dl(getSession()->getThreadInterupt());
156
 
      try {
157
 
        thread->join();
158
 
      }
159
 
      catch(boost::thread_interrupted const&)
160
 
      {
161
 
        // Just surpress and return the error
162
 
        my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
163
 
 
164
 
        return false;
165
 
      }
166
 
    }
 
124
    drizzled::Execute executer(*getSession(), should_wait);
 
125
    executer.run(to_execute.str, to_execute.length);
167
126
  }
168
 
  else 
 
127
  else // Non-concurrent run.
169
128
  {
170
129
    if (is_quiet)
171
130
    {