~drizzle-trunk/drizzle/development

2116.1.31 by David Shrewsbury
Major refactor of common functionality into new classes.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2011 David Shrewsbury
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
2116.1.31 by David Shrewsbury
Major refactor of common functionality into new classes.
22
23
#include <string>
24
#include <vector>
25
#include <drizzled/session.h>
26
27
namespace slave
28
{
29
30
class SQLExecutor
31
{
32
public:
33
34
  SQLExecutor(const std::string &user, const std::string &schema);
35
36
  void markInErrorState()
37
  {
38
    _in_error_state= true;
39
  }
40
41
  void clearErrorState()
42
  {
43
    _in_error_state= false;
44
  }
45
46
  const std::string &getErrorMessage()
47
  {
48
    return _error_message;
49
  }
50
51
  /**
52
   * Execute a batch of SQL statements.
53
   *
54
   * @param sql Batch of SQL statements to execute.
55
   *
56
   * @retval true Success
57
   * @retval false Failure
58
   */
59
  bool executeSQL(std::vector<std::string> &sql);
60
61
protected:
62
  drizzled::Session::shared_ptr _session;
63
64
private:
65
  bool _in_error_state;
66
  std::string _error_message;
67
68
};
69
70
} /* namespace slave */
71