~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/slave/sql_executor.h

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
21
#pragma once
 
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