MySQL 8.4.3
Source Code Documentation
Explain_format Class Referenceabstract

Base class for structured and hierarchical EXPLAIN output formatters. More...

#include <opt_explain_format.h>

Inheritance diagram for Explain_format:
[legend]

Public Member Functions

virtual ~Explain_format ()=default
 
virtual bool is_hierarchical () const =0
 A hierarchical text or a plain table. More...
 
virtual bool is_iterator_based () const
 Whether the format closely resembles the final plan to be executed by execution iterators (See RowIterator). More...
 
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...
 
virtual bool send_headers (Query_result *result)
 Send EXPLAIN header item(s) to output stream. More...
 
virtual bool begin_context (enum_parsing_context context, Query_expression *subquery=nullptr, const Explain_format_flags *flags=nullptr)=0
 Enter a specified context. More...
 
virtual bool end_context (enum_parsing_context context)=0
 Leave the current context. More...
 
virtual bool flush_entry ()=0
 Flush TABLE/JOIN_TAB property set. More...
 
virtual qep_rowentry ()=0
 Get a pointer to the current TABLE/JOIN_TAB property set. More...
 
virtual std::string ExplainJsonToString (Json_object *json)
 Convert Json object to string. More...
 

Public Attributes

LEX_CSTRING m_schema_name_for_explain
 

Protected Member Functions

 Explain_format ()
 
 Explain_format (std::optional< std::string_view > explain_into_variable_name)
 

Protected Attributes

Query_resultoutput
 output resulting data there More...
 

Private Member Functions

 Explain_format (Explain_format &)
 
Explain_formatoperator= (Explain_format &)
 

Private Attributes

std::optional< std::string_view > m_explain_into_variable_name
 

Detailed Description

Base class for structured and hierarchical EXPLAIN output formatters.

Constructor & Destructor Documentation

◆ Explain_format() [1/3]

Explain_format::Explain_format ( Explain_format )
private

◆ Explain_format() [2/3]

Explain_format::Explain_format ( )
inlineprotected

◆ Explain_format() [3/3]

Explain_format::Explain_format ( std::optional< std::string_view >  explain_into_variable_name)
inlineexplicitprotected

◆ ~Explain_format()

virtual Explain_format::~Explain_format ( )
virtualdefault

Member Function Documentation

◆ begin_context()

virtual bool Explain_format::begin_context ( enum_parsing_context  context,
Query_expression subquery = nullptr,
const Explain_format_flags flags = nullptr 
)
pure virtual

Enter a specified context.

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

Implemented in Explain_format_JSON, Explain_format_traditional, and Explain_format_tree.

◆ end_context()

virtual bool Explain_format::end_context ( enum_parsing_context  context)
pure virtual

Leave the current context.

Parameters
contextcurrent context type (for validation/debugging)

Implemented in Explain_format_JSON, Explain_format_traditional, and Explain_format_tree.

◆ entry()

virtual qep_row * Explain_format::entry ( )
pure virtual

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

Implemented in Explain_format_JSON, Explain_format_traditional, and Explain_format_tree.

◆ explain_into_variable_name()

std::string_view Explain_format::explain_into_variable_name ( ) const
inline

Returns the name of the user variable the output of this EXPLAIN statement is to be stored in.

Should only be called if this is an EXPLAIN INTO statement.

Returns
std::string_view The name of the variable to store the output in.

◆ ExplainJsonToString()

virtual std::string Explain_format::ExplainJsonToString ( Json_object json)
inlinevirtual

Convert Json object to string.

Should only be called for iterator-based formats.

Reimplemented in Explain_format_JSON, and Explain_format_tree.

◆ flush_entry()

virtual bool Explain_format::flush_entry ( )
pure virtual

Flush TABLE/JOIN_TAB property set.

For traditional EXPLAIN: output a single EXPLAIN row.

Implemented in Explain_format_JSON, Explain_format_traditional, and Explain_format_tree.

◆ is_explain_for_schema()

bool Explain_format::is_explain_for_schema ( ) const
inline

Whether the EXPLAIN statement should be run in another schema than the current active schema.

If this returns true, m_schema_name_for_explain contains the name of the schema to use for EXPLAIN.

Returns
true The EXPLAIN statement should be run in another schema.
false The EXPLAIN statement should be run in the current active schema.

◆ is_explain_into()

bool Explain_format::is_explain_into ( ) const
inline

Whether the output of an EXPLAIN statement should be stored in a user variable or sent to the client.

If this function returns true, explain_into_variable_name() returns the name of the variable.

Return values
trueEXPLAIN output should be stored in a user variable.
falseEXPLAIN output should be sent to the client.

◆ is_hierarchical()

virtual bool Explain_format::is_hierarchical ( ) const
pure virtual

A hierarchical text or a plain table.

Return values
trueFormatter produces hierarchical text
falseTraditional explain

Implemented in Explain_format_JSON, Explain_format_traditional, and Explain_format_tree.

◆ is_iterator_based()

virtual bool Explain_format::is_iterator_based ( ) const
inlinevirtual

Whether the format closely resembles the final plan to be executed by execution iterators (See RowIterator).

These formats share a common logic that uses AccessPath structure to generate the information, so they all display exactly the same information, even though the style of each format might be different.

Note
: The new json format for hypergraph and the tree format are examples of iterator-based formats.
Return values
trueFormat is Iterator-based.
falseFormat is not Iterator-based.

Reimplemented in Explain_format_JSON, and Explain_format_tree.

◆ operator=()

Explain_format & Explain_format::operator= ( Explain_format )
private

◆ send_headers()

virtual bool Explain_format::send_headers ( Query_result result)
inlinevirtual

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 in Explain_format_tree, Explain_format_JSON, and Explain_format_traditional.

Member Data Documentation

◆ m_explain_into_variable_name

std::optional<std::string_view> Explain_format::m_explain_into_variable_name
private

◆ m_schema_name_for_explain

LEX_CSTRING Explain_format::m_schema_name_for_explain

◆ output

Query_result* Explain_format::output
protected

output resulting data there


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