MySQL 8.0.29
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, 2021, 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 also distributed 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 included with MySQL.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24
25/**
26 @file select_lex_visitor.h
27 Visitor interface for parse trees.
28*/
29
31class Query_block;
32class Item;
33
34/**
35 Abstract base class for traversing the Query_block tree. In order to use it,
36 a client defines a subclass, overriding the member functions that visit the
37 objects of interest. If a function returns true, traversal is aborted.
38*/
40 public:
41 virtual bool visits_in_prefix_order() const { return true; }
42
43 bool visit(Query_expression *unit) { return visit_union(unit); }
44 bool visit(Query_block *query_block) {
45 return visit_query_block(query_block);
46 }
47
48 /// Called for all nodes of all expression trees (i.e. Item trees).
49 bool visit(Item *item) { return visit_item(item); }
50
51 virtual ~Select_lex_visitor() = 0;
52
53 protected:
54 virtual bool visit_union(Query_expression *) { return false; }
55 virtual bool visit_query_block(Query_block *) { return false; }
56 virtual bool visit_item(Item *) { return false; }
57};
58
59#endif // Query_block_VISITOR_INCLUDED
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1124
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:629
Abstract base class for traversing the Query_block tree.
Definition: select_lex_visitor.h:39
virtual bool visit_union(Query_expression *)
Definition: select_lex_visitor.h:54
virtual bool visit_item(Item *)
Definition: select_lex_visitor.h:56
bool visit(Query_expression *unit)
Definition: select_lex_visitor.h:43
virtual bool visit_query_block(Query_block *)
Definition: select_lex_visitor.h:55
bool visit(Item *item)
Called for all nodes of all expression trees (i.e. Item trees).
Definition: select_lex_visitor.h:49
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:41
bool visit(Query_block *query_block)
Definition: select_lex_visitor.h:44