23 #include <drizzled/session.h>
24 #include <drizzled/session/cache.h>
25 #include <plugin/utility_functions/functions.h>
28 namespace utility_functions {
32 int64_t session_id_for_kill= args[0]->
val_int();
34 if (getSession().getSessionId() == session_id_for_kill)
36 my_error(drizzled::ER_KILL_DENY_SELF_ERROR, MYF(0));
40 Session::shared_ptr die_session(session::Cache::find(session_id_for_kill));
44 my_error(drizzled::ER_NO_SUCH_THREAD, session_id_for_kill, MYF(0));
48 if (not die_session->isViewable(*getSession().user()))
50 my_error(drizzled::ER_KILL_DENIED_ERROR, session_id_for_kill, MYF(0));
54 die_session->awake(arg_count == 2 ? Session::KILL_QUERY : Session::KILL_CONNECTION);
56 return session_id_for_kill;
virtual int64_t val_int()=0