~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/kill.cc

Does not work (compile issue in plugin).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
22
 
 
23
 
#include <drizzled/kill.h>
 
21
#include "config.h"
 
22
#include <drizzled/show.h>
24
23
#include <drizzled/session.h>
25
24
#include <drizzled/statement/kill.h>
26
 
#include <drizzled/sql_lex.h>
27
 
 
28
 
namespace drizzled {
29
 
namespace statement {
30
 
 
31
 
Kill::Kill(Session *in_session, Item *item, bool is_query_kill) :
32
 
  Statement(in_session)
33
 
  {
34
 
    if (is_query_kill)
35
 
    {
36
 
      lex().type= ONLY_KILL_QUERY;
37
 
    }
38
 
 
39
 
    lex().value_list.clear();
40
 
    lex().value_list.push_front(item);
41
 
    set_command(SQLCOM_KILL);
42
 
  }
43
 
 
44
 
} // namespace statement
 
25
 
 
26
namespace drizzled
 
27
{
45
28
 
46
29
bool statement::Kill::execute()
47
30
{
48
 
  Item *it= &lex().value_list.front();
 
31
  Item *it= (Item *) session->lex->value_list.head();
49
32
 
50
 
  if ((not it->fixed && it->fix_fields(lex().session, &it)) || it->check_cols(1))
 
33
  if ((! it->fixed && it->fix_fields(session->lex->session, &it)) || 
 
34
      it->check_cols(1))
51
35
  {
52
36
    my_message(ER_SET_CONSTANTS_ONLY, 
53
37
               ER(ER_SET_CONSTANTS_ONLY),
54
38
               MYF(0));
55
39
    return true;
56
40
  }
57
 
 
58
 
  if (drizzled::kill(*session().user(), static_cast<session_id_t>(it->val_int()), lex().type & ONLY_KILL_QUERY))
59
 
  {
60
 
    session().my_ok();
61
 
  }
62
 
  else
63
 
  {
64
 
    my_error(ER_NO_SUCH_THREAD, MYF(0), it->val_int());
65
 
  }
66
 
 
 
41
  sql_kill(session, (ulong) it->val_int(), session->lex->type & ONLY_KILL_QUERY);
67
42
  return false;
68
43
}
69
44