~ubuntu-branches/ubuntu/quantal/drizzle/quantal

1 by Monty Taylor
Import upstream version 2010.03.1347
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1.2.4 by Monty Taylor
Import upstream version 2010.12.06
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
1 by Monty Taylor
Import upstream version 2010.03.1347
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
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
21
#pragma once
1 by Monty Taylor
Import upstream version 2010.03.1347
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
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
29
namespace drizzled {
1 by Monty Taylor
Import upstream version 2010.03.1347
30
31
class Session;
32
class TableList;
33
class Item;
34
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
35
namespace session { class Transactions; }
36
37
namespace statement {
1 by Monty Taylor
Import upstream version 2010.03.1347
38
39
/**
40
 * @class Statement
41
 * @brief Represents a statement to be executed
42
 */
43
class Statement
44
{
45
public:
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
46
  Statement(Session *in_session) :
47
    _session(*in_session)
1 by Monty Taylor
Import upstream version 2010.03.1347
48
  {}
49
50
  virtual ~Statement() {}
51
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
52
  void set_command(enum_sql_command);
53
  LEX& lex();
54
  session::Transactions& transaction();
55
1 by Monty Taylor
Import upstream version 2010.03.1347
56
  /**
57
   * Execute the statement.
58
   *
59
   * @return true on failure; false on success
60
   */
61
  virtual bool execute()= 0;
62
1.2.8 by Monty Taylor
Import upstream version 2011.02.10
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
  {
67
    return false;
68
  }
69
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
70
  Session& session() const
1.2.7 by Monty Taylor
Import upstream version 2011.02.09
71
  {
72
    return _session;
1.2.1 by Monty Taylor
Import upstream version 2010.11.03
73
  }
74
1.2.6 by Monty Taylor
Import upstream version 2011.01.08
75
  virtual bool isShow() { return false; }
76
1.2.7 by Monty Taylor
Import upstream version 2011.02.09
77
private:
1.2.10 by Monty Taylor
Import upstream version 2011.03.13
78
  Session& _session;
1 by Monty Taylor
Import upstream version 2010.03.1347
79
};
80
81
} /* namespace statement */
82
} /* namespace drizzled */
83