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"
115
116
if (is_concurrent)
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
util::string::const_shared_ptr schema(getSession()->schema());
128
if (not schema->empty())
129
new_session->set_db(*schema);
131
new_session->setConcurrentExecute(false);
133
// Overwrite the context in the next session, with what we have in our
134
// session. Eventually we will allow someone to change the effective
136
new_session->getSecurityContext()= getSession()->getSecurityContext();
138
if (Session::schedule(new_session))
140
Session::unlink(new_session);
142
else if (should_wait)
144
thread= new_session->getThread();
118
if (not getSession()->isConcurrentExecuteAllowed())
149
120
my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
153
if (should_wait && thread && thread->joinable())
155
// We want to make sure that we can be killed
156
boost::this_thread::restore_interruption dl(getSession()->getThreadInterupt());
160
catch(boost::thread_interrupted const&)
162
// Just surpress and return the error
163
my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
124
drizzled::Execute executer(*getSession(), should_wait);
125
executer.run(to_execute.str, to_execute.length);
127
else // Non-concurrent run.