~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/kill.cc

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

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 <drizzled/server_includes.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
using namespace drizzled;
45
27
 
46
28
bool statement::Kill::execute()
47
29
{
48
 
  Item *it= &lex().value_list.front();
 
30
  Item *it= (Item *) session->lex->value_list.head();
49
31
 
50
 
  if ((not it->fixed && it->fix_fields(lex().session, &it)) || it->check_cols(1))
 
32
  if ((! it->fixed && it->fix_fields(session->lex->session, &it)) || 
 
33
      it->check_cols(1))
51
34
  {
52
35
    my_message(ER_SET_CONSTANTS_ONLY, 
53
36
               ER(ER_SET_CONSTANTS_ONLY),
54
37
               MYF(0));
55
38
    return true;
56
39
  }
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
 
 
 
40
  sql_kill(session, (ulong) it->val_int(), session->lex->type & ONLY_KILL_QUERY);
67
41
  return false;
68
42
}
69
 
 
70
 
} /* namespace drizzled */
71