MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sql_handler.h
1 /* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #ifndef SQL_HANDLER_INCLUDED
17 #define SQL_HANDLER_INCLUDED
18 
19 #include "sql_class.h" /* enum_ha_read_mode */
20 #include "my_base.h" /* ha_rkey_function, ha_rows */
21 #include "sql_list.h" /* List */
22 
23 class THD;
24 struct TABLE_LIST;
25 
34 {
35 public:
37  {}
38 
39  virtual ~Sql_cmd_handler_open()
40  {}
41 
42  virtual enum_sql_command sql_command_code() const
43  {
44  return SQLCOM_HA_OPEN;
45  }
46 
47  virtual bool execute(THD *thd);
48 };
49 
50 
60 {
61 public:
62  Sql_cmd_handler_read(enum_ha_read_modes read_mode,
63  const char *key_name,
64  List<Item> *key_expr,
65  ha_rkey_function rkey_mode)
66  : m_read_mode(read_mode), m_key_name(key_name), m_key_expr(key_expr),
67  m_rkey_mode(rkey_mode)
68  {}
69 
70  virtual ~Sql_cmd_handler_read()
71  {}
72 
73  virtual enum_sql_command sql_command_code() const
74  {
75  return SQLCOM_HA_READ;
76  }
77 
78  virtual bool execute(THD *thd);
79 
80 private:
82  enum enum_ha_read_modes m_read_mode;
83 
88  const char *m_key_name;
89 
91  List<Item> *m_key_expr;
92 
94  enum ha_rkey_function m_rkey_mode;
95 };
96 
97 
106 {
107 public:
109  {}
110 
111  virtual ~Sql_cmd_handler_close()
112  {}
113 
114  virtual enum_sql_command sql_command_code() const
115  {
116  return SQLCOM_HA_CLOSE;
117  }
118 
119  virtual bool execute(THD *thd);
120 };
121 
122 
123 void mysql_ha_flush(THD *thd);
124 void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables);
125 void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
126 void mysql_ha_cleanup(THD *thd);
127 void mysql_ha_set_explicit_lock_duration(THD *thd);
128 
129 typedef bool Log_func(THD*, TABLE*, bool,
130  const uchar*, const uchar*);
131 
133  const uchar *before_record,
134  const uchar *after_record,
135  Log_func *log_func);
136 
137 #endif /* SQL_HANDLER_INCLUDED */