MySQL 8.4.0
Source Code Documentation
select_lex_visitor.h
Go to the documentation of this file.
1#ifndef Query_block_VISITOR_INCLUDED
2#define Query_block_VISITOR_INCLUDED
3/* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26/**
27 @file select_lex_visitor.h
28 Visitor interface for parse trees.
29*/
30
32class Query_block;
33class Item;
34
35/**
36 Abstract base class for traversing the Query_block tree. In order to use it,
37 a client defines a subclass, overriding the member functions that visit the
38 objects of interest. If a function returns true, traversal is aborted.
39*/
41 public:
42 virtual bool visits_in_prefix_order() const { return true; }
43
44 bool visit(Query_expression *unit) { return visit_union(unit); }
45 bool visit(Query_block *query_block) {
46 return visit_query_block(query_block);
47 }
48
49 /// Called for all nodes of all expression trees (i.e. Item trees).
50 bool visit(Item *item) { return visit_item(item); }
51
52 virtual ~Select_lex_visitor() = 0;
53
54 protected:
55 virtual bool visit_union(Query_expression *) { return false; }
56 virtual bool visit_query_block(Query_block *) { return false; }
57 virtual bool visit_item(Item *) { return false; }
58};
59
60#endif // Query_block_VISITOR_INCLUDED
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:934
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1163
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:626
Abstract base class for traversing the Query_block tree.
Definition: select_lex_visitor.h:40
virtual bool visit_union(Query_expression *)
Definition: select_lex_visitor.h:55
virtual bool visit_item(Item *)
Definition: select_lex_visitor.h:57
bool visit(Query_expression *unit)
Definition: select_lex_visitor.h:44
virtual bool visit_query_block(Query_block *)
Definition: select_lex_visitor.h:56
bool visit(Item *item)
Called for all nodes of all expression trees (i.e. Item trees).
Definition: select_lex_visitor.h:50
virtual ~Select_lex_visitor()=0
Gcc demands an implementation for a virtual destructor.
virtual bool visits_in_prefix_order() const
Definition: select_lex_visitor.h:42
bool visit(Query_block *query_block)
Definition: select_lex_visitor.h:45