~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/kill.cc

  • Committer: Olaf van der Spek
  • Date: 2011-07-04 19:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 2367.
  • Revision ID: olafvdspek@gmail.com-20110704191147-s99ojek811zi1fzj
RemoveĀ unusedĀ Name_resolution_context::error_reporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
22
 
#include <drizzled/show.h>
 
21
#include <config.h>
 
22
 
 
23
#include <drizzled/kill.h>
23
24
#include <drizzled/session.h>
24
 
#include <drizzled/session/cache.h>
25
25
#include <drizzled/statement/kill.h>
26
 
 
27
 
namespace drizzled
28
 
{
29
 
 
30
 
namespace statement
31
 
{
 
26
#include <drizzled/sql_lex.h>
 
27
 
 
28
namespace drizzled {
 
29
namespace statement {
32
30
 
33
31
Kill::Kill(Session *in_session, Item *item, bool is_query_kill) :
34
32
  Statement(in_session)
35
33
  {
36
34
    if (is_query_kill)
37
35
    {
38
 
      getSession()->getLex()->type= ONLY_KILL_QUERY;
 
36
      lex().type= ONLY_KILL_QUERY;
39
37
    }
40
38
 
41
 
    getSession()->getLex()->value_list.empty();
42
 
    getSession()->getLex()->value_list.push_front(item);
43
 
    getSession()->getLex()->sql_command= SQLCOM_KILL;
 
39
    lex().value_list.clear();
 
40
    lex().value_list.push_front(item);
 
41
    set_command(SQLCOM_KILL);
44
42
  }
45
43
 
46
44
} // namespace statement
47
45
 
48
 
bool statement::Kill::kill(session_id_t id, bool only_kill_query)
49
 
{
50
 
  drizzled::Session::shared_ptr session_param= session::Cache::singleton().find(id);
51
 
 
52
 
  if (session_param and session_param->isViewable(*getSession()->user()))
53
 
  {
54
 
    session_param->awake(only_kill_query ? Session::KILL_QUERY : Session::KILL_CONNECTION);
55
 
    return true;
56
 
  }
57
 
 
58
 
  return false;
59
 
}
60
 
 
61
46
bool statement::Kill::execute()
62
47
{
63
 
  Item *it= (Item *) getSession()->lex->value_list.head();
 
48
  Item *it= &lex().value_list.front();
64
49
 
65
 
  if ((not it->fixed && it->fix_fields(getSession()->lex->session, &it)) || it->check_cols(1))
 
50
  if ((not it->fixed && it->fix_fields(lex().session, &it)) || it->check_cols(1))
66
51
  {
67
52
    my_message(ER_SET_CONSTANTS_ONLY, 
68
53
               ER(ER_SET_CONSTANTS_ONLY),
70
55
    return true;
71
56
  }
72
57
 
73
 
  if (kill(static_cast<session_id_t>(it->val_int()), getSession()->lex->type & ONLY_KILL_QUERY))
 
58
  if (drizzled::kill(*session().user(), static_cast<session_id_t>(it->val_int()), lex().type & ONLY_KILL_QUERY))
74
59
  {
75
 
    getSession()->my_ok();
 
60
    session().my_ok();
76
61
  }
77
62
  else
78
63
  {