Drizzled Public API Documentation

sql_executor.h
1 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2012 Mohit Srivastava
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  */
25 #pragma once
26 
27 #include <vector>
28 #include <drizzled/session.h>
29 #include <drizzled/plugin/listen.h>
30 #include <drizzled/plugin/client.h>
31 #include <drizzled/catalog/local.h>
32 #include <drizzled/execute.h>
33 #include <drizzled/sql/result_set.h>
34 #include <drizzled/errmsg_print.h>
35 #include <drizzled/plugin.h>
36 
37 
38 using namespace std;
39 using namespace drizzled;
40 
44 namespace drizzle_plugin
45 {
49 namespace json_server
50 {
55  {
56  public:
63  SQLExecutor(const string &schema);
64 
69  {
70  _in_error_state= true;
71  }
72 
77  {
78  _in_error_state= false;
79  }
80 
86  {
87  return _exception;
88  }
89 
95  {
96  return _result_set;
97  }
98 
103  const string& getSql() const
104  {
105  return _sql;
106  }
107 
112  const drizzled::error_t& getErr() const
113  {
114  return _err;
115  }
116 
123  bool executeSQL(string &sql);
124 
125  protected:
129  drizzled::Session::shared_ptr _session;
130 
131  private:
143  drizzled::error_t _err;
151  string _sql;
152  };
153 
154 }
155 }
156