MySQL 9.0.0
Source Code Documentation
Opt_trace_disable_I_S Class Reference

Instantiate an instance of this class for specific cases where optimizer trace, in a certain section of Optimizer code, should write only to DBUG and not I_S. More...

#include <opt_trace.h>

Public Member Functions

 Opt_trace_disable_I_S (Opt_trace_context *ctx_arg, bool disable_arg)
 
 ~Opt_trace_disable_I_S ()
 Destructor. Restores trace's "enabled" property to its previous value. More...
 

Private Member Functions

 Opt_trace_disable_I_S (const Opt_trace_disable_I_S &)
 
Opt_trace_disable_I_Soperator= (const Opt_trace_disable_I_S &)
 

Private Attributes

Opt_trace_contextctx
 Context. More...
 

Detailed Description

Instantiate an instance of this class for specific cases where optimizer trace, in a certain section of Optimizer code, should write only to DBUG and not I_S.

Example: see sql_select.cc. Note that this class should rarely be used; the "feature" parameter of Opt_trace_struct is a good alternative.

Constructor & Destructor Documentation

◆ Opt_trace_disable_I_S() [1/2]

Opt_trace_disable_I_S::Opt_trace_disable_I_S ( Opt_trace_context ctx_arg,
bool  disable_arg 
)
inline
 @param  ctx_arg      Context.
 @param  disable_arg  Whether the instance should really disable
                      anything. If false, the object is dummy. If true,
                      tracing-to-I_S is disabled at construction and
                      re-enabled at destruction.
 @details A dummy instance is there only for RAII reasons. Imagine we want
 to do this:
     {
       if (x) disable tracing;
       code;
     } // tracing should be re-enabled here

As we use RAII, we cannot put the instance declaration inside if(x):

     {
       if (x) Opt_trace_disable_I_S instance(ctx);
       code;
     }

because it would be destroyed as soon as the if() block is left, so tracing would be re-enabled before code;. It should rather be written as:

     {
       Opt_trace_disable_I_S instance(ctx, x); // if !x, does nothing
       code;
     } // re-enabling happens here, if x is true

◆ ~Opt_trace_disable_I_S()

Opt_trace_disable_I_S::~Opt_trace_disable_I_S ( )
inline

Destructor. Restores trace's "enabled" property to its previous value.

◆ Opt_trace_disable_I_S() [2/2]

Opt_trace_disable_I_S::Opt_trace_disable_I_S ( const Opt_trace_disable_I_S )
private

Member Function Documentation

◆ operator=()

Opt_trace_disable_I_S & Opt_trace_disable_I_S::operator= ( const Opt_trace_disable_I_S )
private

Member Data Documentation

◆ ctx

Opt_trace_context* Opt_trace_disable_I_S::ctx
private

Context.

Non-NULL if and only if this instance really does disabling


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