~drizzle-trunk/drizzle/development

1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
22
23
#include <drizzled/definitions.h>
24
#include <drizzled/error.h>
25
#include <drizzled/sql_parse.h>
26
#include <drizzled/sql_base.h>
27
#include <drizzled/show.h>
28
2224.2.1 by Olaf van der Spek
Refactor
29
namespace drizzled {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
30
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
31
class Session;
32
class TableList;
33
class Item;
34
2224.2.1 by Olaf van der Spek
Refactor
35
namespace session { class Transactions; }
36
37
namespace statement {
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
38
39
/**
1100.3.30 by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to
40
 * @class Statement
1100.3.28 by Padraig O'Sullivan
Renamed the command namespace where I was declaring all of these commands to
41
 * @brief Represents a statement to be executed
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
42
 */
1100.3.30 by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to
43
class Statement
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
44
{
45
public:
2224.2.1 by Olaf van der Spek
Refactor
46
  Statement(Session *in_session) :
47
    _session(*in_session)
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
48
  {}
49
1100.3.30 by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to
50
  virtual ~Statement() {}
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
51
2224.2.6 by Olaf van der Spek
Statement::set_command
52
  void set_command(enum_sql_command);
53
  LEX& lex();
2224.2.1 by Olaf van der Spek
Refactor
54
  session::Transactions& transaction();
55
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
56
  /**
1100.3.28 by Padraig O'Sullivan
Renamed the command namespace where I was declaring all of these commands to
57
   * Execute the statement.
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
58
   *
1100.3.25 by Padraig O'Sullivan
Changed return type of the execute() function in Command classes to be bool
59
   * @return true on failure; false on success
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
60
   */
1100.3.25 by Padraig O'Sullivan
Changed return type of the execute() function in Command classes to be bool
61
  virtual bool execute()= 0;
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
62
2140.2.6 by Stewart Smith
be sure to start a transaction with a startTransaction call on the first statement when autocommit is OFF. The only statements that DO NOT do this are a) DDL and b) SELECT without a table (e.g. SELECT DATABASE() and SHOW STATUS.
63
  /* True if can be in transaction. Currently only DDL is not.
64
     This should go away when DDL commands are within transactions. */
65
  virtual bool isTransactional()
66
  {
2140.2.9 by Stewart Smith
switch default Statement::isTransactional() to false, have explicit overriding of true where needed.
67
    return false;
2140.2.6 by Stewart Smith
be sure to start a transaction with a startTransaction call on the first statement when autocommit is OFF. The only statements that DO NOT do this are a) DDL and b) SELECT without a table (e.g. SELECT DATABASE() and SHOW STATUS.
68
  }
69
2224.2.1 by Olaf van der Spek
Refactor
70
  Session& session() const
2104.1.1 by Brian Aker
Merge in update to use console for catalog DDL.
71
  {
72
    return _session;
73
  }
74
2059.1.1 by Andrew Hutchings
Refix show_dictionary plugin crash when not using 'SHOW' to access.
75
  virtual bool isShow() { return false; }
76
2098.4.1 by Brian Aker
Make session encapsulated.
77
private:
2224.2.1 by Olaf van der Spek
Refactor
78
  Session& _session;
1100.3.4 by Padraig O'Sullivan
Updates based on code review from Jay.
79
};
80
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
81
} /* namespace statement */
82
} /* namespace drizzled */
1100.3.1 by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method.
83