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...
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.
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