23#include <drizzled/execute/common.h>
25#include <drizzled/session.h>
26#include <drizzled/user_var_entry.h>
27#include <drizzled/plugin/client/cached.h>
28#include <drizzled/plugin/client/concurrent.h>
29#include <drizzled/catalog/local.h>
30#include <drizzled/execute.h>
34Execute::Execute(
Session &arg,
bool wait_arg) :
40void Execute::run(str_ref execution_string, sql::ResultSet &result_set)
42 if (not _session.isConcurrentExecuteAllowed())
44 my_error(ER_WRONG_ARGUMENTS, MYF(0),
"A Concurrent Execution Session can not launch another session.");
49 plugin::client::Cached *client=
new plugin::client::Cached(result_set);
50 client->pushSQL(execution_string);
51 Session::shared_ptr new_session= Session::make_shared(client, catalog::local());
54 util::string::ptr schema(_session.schema());
55 if (not schema->empty())
56 new_session->set_schema(*schema);
58 new_session->setConcurrentExecute(
false);
63 new_session->user()= _session.user();
64 new_session->setOriginatingServerUUID(_session.getOriginatingServerUUID());
65 new_session->setOriginatingCommitID(_session.getOriginatingCommitID());
67 if (Session::schedule(new_session))
69 Session::unlink(new_session);
73 thread= new_session->getThread();
77 if (wait && thread && thread->joinable())
80 if (_session.getThread())
82 boost::this_thread::restore_interruption dl(_session.getThreadInterupt());
88 catch(boost::thread_interrupted
const&)
91 my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
102void Execute::run(str_ref execution_string)
104 if (not _session.isConcurrentExecuteAllowed())
106 my_error(ER_WRONG_ARGUMENTS, MYF(0),
"A Concurrent Execution Session can not launch another session.");
111 plugin::client::Concurrent *client=
new plugin::client::Concurrent;
112 client->pushSQL(execution_string);
113 Session::shared_ptr new_session= Session::make_shared(client, catalog::local());
116 util::string::ptr schema(_session.schema());
117 if (not schema->empty())
118 new_session->set_schema(*schema);
120 new_session->setConcurrentExecute(
false);
125 new_session->user()= _session.user();
127 if (Session::schedule(new_session))
129 Session::unlink(new_session);
133 thread= new_session->getThread();
137 if (wait && thread && thread->joinable())
140 if (_session.getThread())
142 boost::this_thread::restore_interruption dl(_session.getThreadInterupt());
148 catch(boost::thread_interrupted
const&)
151 my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
TODO: Rename this file - func.h is stupid.