1 /* Copyright (c) 2011, 2021, 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 also distributed 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 included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software Foundation,
21    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 
23 
24 #ifndef OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
25 #define OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
26 
27 #include "opt_explain_format.h"
28 
29 /**
30   Formatter for the traditional EXPLAIN output
31 */
32 
33 class Explain_format_traditional : public Explain_format
34 {
35   class Item_null *nil;
36   qep_row column_buffer; ///< buffer for the current output row
37 
38 public:
Explain_format_traditional()39   Explain_format_traditional() : nil(NULL) {}
40 
is_hierarchical()41   virtual bool is_hierarchical() const { return false; }
42   virtual bool send_headers(Query_result *result);
begin_context(enum_parsing_context,SELECT_LEX_UNIT * subquery,const Explain_format_flags * flags)43   virtual bool begin_context(enum_parsing_context,
44                              SELECT_LEX_UNIT *subquery,
45                              const Explain_format_flags *flags)
46   {
47     return false;
48   }
end_context(enum_parsing_context)49   virtual bool end_context(enum_parsing_context) { return false; }
50   virtual bool flush_entry();
entry()51   virtual qep_row *entry() { return &column_buffer; }
52 
53 private:
54   bool push_select_type(List<Item> *items);
55 };
56 
57 #endif//OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
58