23
23
#include "drizzled/statement/execute.h"
24
24
#include "drizzled/session.h"
25
#include "drizzled/execute.h"
26
25
#include "drizzled/user_var_entry.h"
27
26
#include "drizzled/plugin/listen.h"
28
27
#include "drizzled/plugin/client.h"
116
115
if (is_concurrent)
118
if (not getSession()->isConcurrentExecuteAllowed())
117
boost_thread_shared_ptr thread;
119
if (getSession()->isConcurrentExecuteAllowed())
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));
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());
130
new_session->setConcurrentExecute(false);
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
135
new_session->getSecurityContext()= getSession()->getSecurityContext();
137
if (Session::schedule(new_session))
139
Session::unlink(new_session);
141
else if (should_wait)
143
thread= new_session->getThread();
120
148
my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
124
drizzled::Execute executer(*getSession(), should_wait);
125
executer.run(to_execute.str, to_execute.length);
152
if (should_wait && thread && thread->joinable())
154
// We want to make sure that we can be killed
155
boost::this_thread::restore_interruption dl(getSession()->getThreadInterupt());
159
catch(boost::thread_interrupted const&)
161
// Just surpress and return the error
162
my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
127
else // Non-concurrent run.