MySQL  8.0.16
Source Code Documentation
select_lex_visitor.h
Go to the documentation of this file.
1 #ifndef SELECT_LEX_VISITOR_INCLUDED
2 #define SELECT_LEX_VISITOR_INCLUDED
3 /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
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 
30 class SELECT_LEX_UNIT;
31 class SELECT_LEX;
32 class Item;
33 
34 /**
35  Abstract base class for traversing the SELECT_LEX 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(SELECT_LEX_UNIT *unit) { return visit_union(unit); }
44  bool visit(SELECT_LEX *select_lex) { return visit_query_block(select_lex); }
45 
46  /// Called for all nodes of all expression trees (i.e. Item trees).
47  bool visit(Item *item) { return visit_item(item); }
48 
49  virtual ~Select_lex_visitor() = 0;
50 
51  protected:
52  virtual bool visit_union(SELECT_LEX_UNIT *) { return false; }
53  virtual bool visit_query_block(SELECT_LEX *) { return false; }
54  virtual bool visit_item(Item *) { return false; }
55 };
56 
57 #endif // SELECT_LEX_VISITOR_INCLUDED
virtual bool visit_query_block(SELECT_LEX *)
Definition: select_lex_visitor.h:53
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:922
Abstract base class for traversing the SELECT_LEX tree.
Definition: select_lex_visitor.h:39
bool visit(SELECT_LEX *select_lex)
Definition: select_lex_visitor.h:44
virtual ~Select_lex_visitor()=0
Gcc demands an implementation for a virtual destructor.
Definition: select_lex_visitor.cc:31
bool visit(SELECT_LEX_UNIT *unit)
Definition: select_lex_visitor.h:43
virtual bool visit_union(SELECT_LEX_UNIT *)
Definition: select_lex_visitor.h:52
Definition: item.h:666
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:614
virtual bool visits_in_prefix_order() const
Definition: select_lex_visitor.h:41
bool visit(Item *item)
Called for all nodes of all expression trees (i.e. Item trees).
Definition: select_lex_visitor.h:47
virtual bool visit_item(Item *)
Definition: select_lex_visitor.h:54