MySQL 8.4.2
Source Code Documentation
Explain_format_JSON Class Reference

Formatter class for EXPLAIN FORMAT=JSON output. More...

#include <opt_explain_json.h>

Inheritance diagram for Explain_format_JSON:
[legend]

Public Types

enum class  FormatVersion { kLinear , kIteratorBased }
 

Public Member Functions

 Explain_format_JSON (FormatVersion version, std::optional< std::string_view > explain_into_variable_name)
 
bool is_hierarchical () const override
 A hierarchical text or a plain table. More...
 
bool is_iterator_based () const override
 Format versions newer than Linear are always going to be iterator-based. More...
 
bool send_headers (Query_result *result) override
 Send EXPLAIN header item(s) to output stream. More...
 
bool begin_context (enum_parsing_context context, Query_expression *subquery, const Explain_format_flags *flags) override
 Enter a specified context. More...
 
bool end_context (enum_parsing_context context) override
 Leave the current context. More...
 
bool flush_entry () override
 Flush TABLE/JOIN_TAB property set. More...
 
qep_rowentry () override
 Get a pointer to the current TABLE/JOIN_TAB property set. More...
 
std::string ExplainJsonToString (Json_object *json) override
 Convert Json object to string. More...
 
- Public Member Functions inherited from Explain_format
virtual ~Explain_format ()=default
 
bool is_explain_into () const
 Whether the output of an EXPLAIN statement should be stored in a user variable or sent to the client. More...
 
bool is_explain_for_schema () const
 Whether the EXPLAIN statement should be run in another schema than the current active schema. More...
 
std::string_view explain_into_variable_name () const
 Returns the name of the user variable the output of this EXPLAIN statement is to be stored in. More...
 

Private Attributes

opt_explain_json_namespace::contextcurrent_context
 current tree node More...
 
FormatVersion m_version
 

Additional Inherited Members

- Public Attributes inherited from Explain_format
LEX_CSTRING m_schema_name_for_explain
 
- Protected Member Functions inherited from Explain_format
 Explain_format ()
 
 Explain_format (std::optional< std::string_view > explain_into_variable_name)
 
- Protected Attributes inherited from Explain_format
Query_resultoutput
 output resulting data there More...
 

Detailed Description

Formatter class for EXPLAIN FORMAT=JSON output.

Member Enumeration Documentation

◆ FormatVersion

Enumerator
kLinear 
kIteratorBased 

Constructor & Destructor Documentation

◆ Explain_format_JSON()

Explain_format_JSON::Explain_format_JSON ( FormatVersion  version,
std::optional< std::string_view >  explain_into_variable_name 
)
inline

Member Function Documentation

◆ begin_context()

bool Explain_format_JSON::begin_context ( enum_parsing_context  context,
Query_expression subquery,
const Explain_format_flags flags 
)
overridevirtual

Enter a specified context.

Parameters
contextcontext type
subqueryfor CTX_WHERE: unit of the subquery
flagsFormat flags, see Explain_format_flags.

Implements Explain_format.

◆ end_context()

bool Explain_format_JSON::end_context ( enum_parsing_context  context)
overridevirtual

Leave the current context.

Parameters
contextcurrent context type (for validation/debugging)

Implements Explain_format.

◆ entry()

qep_row * Explain_format_JSON::entry ( )
overridevirtual

Get a pointer to the current TABLE/JOIN_TAB property set.

Implements Explain_format.

◆ ExplainJsonToString()

std::string Explain_format_JSON::ExplainJsonToString ( Json_object json)
overridevirtual

Convert Json object to string.

Should only be called for iterator-based formats.

Reimplemented from Explain_format.

◆ flush_entry()

bool Explain_format_JSON::flush_entry ( )
inlineoverridevirtual

Flush TABLE/JOIN_TAB property set.

For traditional EXPLAIN: output a single EXPLAIN row.

Implements Explain_format.

◆ is_hierarchical()

bool Explain_format_JSON::is_hierarchical ( ) const
inlineoverridevirtual

A hierarchical text or a plain table.

Return values
trueFormatter produces hierarchical text
falseTraditional explain

Implements Explain_format.

◆ is_iterator_based()

bool Explain_format_JSON::is_iterator_based ( ) const
inlineoverridevirtual

Format versions newer than Linear are always going to be iterator-based.

Reimplemented from Explain_format.

◆ send_headers()

bool Explain_format_JSON::send_headers ( Query_result result)
overridevirtual

Send EXPLAIN header item(s) to output stream.

Note
: This function caches the output result set pointer for further use.
Parameters
resultoutput result set
Return values
falseOK
trueError

Reimplemented from Explain_format.

Member Data Documentation

◆ current_context

opt_explain_json_namespace::context* Explain_format_JSON::current_context
private

current tree node

◆ m_version

FormatVersion Explain_format_JSON::m_version
private

The documentation for this class was generated from the following files: