23
23
#include <drizzled/session.h>
24
24
#include <drizzled/user_var_entry.h>
25
#include <drizzled/plugin/client/cached.h>
25
26
#include <drizzled/plugin/client/concurrent.h>
26
27
#include <drizzled/catalog/local.h>
27
28
#include <drizzled/execute.h>
45
46
run(execution_string);
49
void Execute::run(std::string &execution_string, sql::ResultSet &result_set)
51
boost_thread_shared_ptr thread;
53
if (_session.isConcurrentExecuteAllowed())
55
plugin::client::Cached *client= new plugin::client::Cached(result_set);
56
client->pushSQL(execution_string);
57
Session::shared_ptr new_session= Session::make_shared(client, catalog::local());
59
// We set the current schema. @todo do the same with catalog
60
util::string::const_shared_ptr schema(_session.schema());
61
if (not schema->empty())
62
new_session->set_db(*schema);
64
new_session->setConcurrentExecute(false);
66
// Overwrite the context in the next session, with what we have in our
67
// session. Eventually we will allow someone to change the effective
69
new_session->user()= _session.user();
71
if (Session::schedule(new_session))
73
Session::unlink(new_session);
77
thread= new_session->getThread();
82
my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
86
if (wait && thread && thread->joinable())
88
// We want to make sure that we can be killed
89
if (_session.getThread())
91
boost::this_thread::restore_interruption dl(_session.getThreadInterupt());
96
catch(boost::thread_interrupted const&)
98
// Just surpress and return the error
99
my_error(drizzled::ER_QUERY_INTERRUPTED, MYF(0));
48
110
void Execute::run(std::string &execution_string)
50
112
boost_thread_shared_ptr thread;