1 /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 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_JSON_INCLUDED 25 #define OPT_EXPLAIN_FORMAT_JSON_INCLUDED 26 27 #include "opt_explain_format.h" 28 29 namespace opt_explain_json_namespace 30 { 31 class context; 32 } 33 34 /** 35 Formatter class for EXPLAIN FORMAT=JSON output 36 */ 37 38 class Explain_format_JSON : public Explain_format 39 { 40 private: 41 opt_explain_json_namespace::context *current_context; ///< current tree node 42 select_result *output; 43 44 public: Explain_format_JSON()45 Explain_format_JSON() : current_context(NULL), output(NULL) {} 46 is_hierarchical()47 virtual bool is_hierarchical() const { return true; } 48 virtual bool send_headers(select_result *result); 49 virtual bool begin_context(Explain_context_enum context, 50 SELECT_LEX_UNIT *subquery, 51 const Explain_format_flags *flags); 52 virtual bool end_context(Explain_context_enum context); flush_entry()53 virtual bool flush_entry() { return false; } 54 virtual qep_row *entry(); 55 }; 56 57 #endif//OPT_EXPLAIN_FORMAT_JSON_INCLUDED 58