MySQL 8.4.0
Source Code Documentation
parse_tree_handler.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
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, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef PARSE_TREE_HANDLER_INCLUDED
25#define PARSE_TREE_HANDLER_INCLUDED
26
27#include <assert.h>
28#include "lex_string.h"
29#include "my_base.h"
30
31#include "parse_tree_nodes.h"
32#include "sql/sql_handler.h" // Sql_cmd_handler_open
33
34class Item;
35class PT_item_list;
36class Sql_cmd;
37class THD;
38class Table_ident;
39struct Parse_context;
40
41class PT_handler_open final : public Parse_tree_root {
42 public:
43 PT_handler_open(Table_ident *table, const LEX_CSTRING &opt_table_alias)
44 : m_table(table), m_opt_table_alias(opt_table_alias.str) {}
45
46 Sql_cmd *make_cmd(THD *thd) override;
47
48 private:
50 const char *const m_opt_table_alias;
51
53};
54
55class PT_handler_close final : public Parse_tree_root {
56 public:
58
59 Sql_cmd *make_cmd(THD *thd) override;
60
61 private:
63
65};
66
68 public:
69 ~PT_handler_read_base() override = 0; // force abstract class
70
71 PT_handler_read_base(const LEX_CSTRING &table, Item *opt_where_clause,
72 PT_limit_clause *opt_limit_clause)
73 : m_table(table),
74 m_opt_where_clause(opt_where_clause),
75 m_opt_limit_clause(opt_limit_clause) {}
76
77 protected:
79
80 private:
84};
85
87
90
91 public:
93 Item *opt_where_clause,
94 PT_limit_clause *opt_limit_clause)
95 : super(table, opt_where_clause, opt_limit_clause),
96 m_direction(direction) {}
97
98 Sql_cmd *make_cmd(THD *thd) override;
99
100 private:
102};
103
106
107 public:
109 enum_ha_read_modes direction, Item *opt_where_clause,
110 PT_limit_clause *opt_limit_clause)
111 : super(table, opt_where_clause, opt_limit_clause),
112 m_index(index.str),
113 m_direction(direction) {
114 assert(direction != enum_ha_read_modes::RKEY);
115 }
116
117 Sql_cmd *make_cmd(THD *thd) override;
118
119 private:
120 const char *const m_index;
122};
123
126
127 public:
129 const LEX_CSTRING &index,
130 ha_rkey_function key_function,
131 PT_item_list *keypart_values,
132 Item *opt_where_clause,
133 PT_limit_clause *opt_limit_clause)
134 : super(table, opt_where_clause, opt_limit_clause),
135 m_index(index.str),
136 m_key_function(key_function),
137 m_keypart_values(keypart_values) {}
138
139 Sql_cmd *make_cmd(THD *thd) override;
140
141 private:
142 const char *const m_index;
145};
146
147#endif // PARSE_TREE_HANDLER_INCLUDED
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:934
Definition: parse_tree_handler.h:55
Sql_cmd_handler_close m_cmd
Definition: parse_tree_handler.h:64
const LEX_CSTRING m_table
Definition: parse_tree_handler.h:62
PT_handler_close(const LEX_CSTRING &table)
Definition: parse_tree_handler.h:57
Sql_cmd * make_cmd(THD *thd) override
Definition: parse_tree_handler.cc:59
Definition: parse_tree_handler.h:124
PT_handler_read_base super
Definition: parse_tree_handler.h:125
Sql_cmd * make_cmd(THD *thd) override
Definition: parse_tree_handler.cc:143
const ha_rkey_function m_key_function
Definition: parse_tree_handler.h:143
PT_handler_index_range_scan(const LEX_CSTRING &table, const LEX_CSTRING &index, ha_rkey_function key_function, PT_item_list *keypart_values, Item *opt_where_clause, PT_limit_clause *opt_limit_clause)
Definition: parse_tree_handler.h:128
const char *const m_index
Definition: parse_tree_handler.h:142
PT_item_list *const m_keypart_values
Definition: parse_tree_handler.h:144
Definition: parse_tree_handler.h:104
Sql_cmd * make_cmd(THD *thd) override
Definition: parse_tree_handler.cc:133
const char *const m_index
Definition: parse_tree_handler.h:120
PT_handler_index_scan(const LEX_CSTRING &table, const LEX_CSTRING &index, enum_ha_read_modes direction, Item *opt_where_clause, PT_limit_clause *opt_limit_clause)
Definition: parse_tree_handler.h:108
const enum_ha_read_modes m_direction
Definition: parse_tree_handler.h:121
PT_handler_read_base super
Definition: parse_tree_handler.h:105
Definition: parse_tree_handler.h:41
PT_handler_open(Table_ident *table, const LEX_CSTRING &opt_table_alias)
Definition: parse_tree_handler.h:43
const char *const m_opt_table_alias
Definition: parse_tree_handler.h:50
Table_ident *const m_table
Definition: parse_tree_handler.h:49
Sql_cmd_handler_open m_cmd
Definition: parse_tree_handler.h:52
Sql_cmd * make_cmd(THD *thd) override
Definition: parse_tree_handler.cc:43
Definition: parse_tree_handler.h:67
~PT_handler_read_base() override=0
const LEX_CSTRING m_table
Definition: parse_tree_handler.h:81
PT_handler_read_base(const LEX_CSTRING &table, Item *opt_where_clause, PT_limit_clause *opt_limit_clause)
Definition: parse_tree_handler.h:71
PT_limit_clause *const m_opt_limit_clause
Definition: parse_tree_handler.h:83
bool do_contextualize(Parse_context *pc)
Definition: parse_tree_handler.cc:78
Item * m_opt_where_clause
Definition: parse_tree_handler.h:82
Definition: parse_tree_handler.h:88
const enum_ha_read_modes m_direction
Definition: parse_tree_handler.h:101
PT_handler_read_base super
Definition: parse_tree_handler.h:89
PT_handler_table_scan(const LEX_CSTRING &table, enum_ha_read_modes direction, Item *opt_where_clause, PT_limit_clause *opt_limit_clause)
Definition: parse_tree_handler.h:92
Sql_cmd * make_cmd(THD *thd) override
Definition: parse_tree_handler.cc:123
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
Definition: parse_tree_nodes.h:428
Base class for all top-level nodes of SQL statements.
Definition: parse_tree_nodes.h:161
Sql_cmd_handler_close represents HANDLER CLOSE statement.
Definition: sql_handler.h:105
Sql_cmd_handler_open represents HANDLER OPEN statement.
Definition: sql_handler.h:46
Representation of an SQL command.
Definition: sql_cmd.h:83
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: sql_lex.h:296
This file includes constants used by all storage engines.
ha_rkey_function
Definition: my_base.h:78
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1073
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
enum_ha_read_modes
Definition: sql_handler.h:35
Definition: mysql_lex_string.h:40
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420