MySQL 9.1.0
Source Code Documentation
Opt_hints Class Referenceabstract

Opt_hints class is used as ancestor for Opt_hints_global, Opt_hints_qb, Opt_hints_table, Opt_hints_key classes. More...

#include <opt_hints.h>

Inheritance diagram for Opt_hints:
[legend]

Public Member Functions

 Opt_hints (const LEX_CSTRING *name_arg, Opt_hints *parent_arg, MEM_ROOT *mem_root_arg)
 
virtual ~Opt_hints ()=default
 
bool is_specified (opt_hints_enum type_arg) const
 
bool set_switch (bool switch_state_arg, opt_hints_enum type_arg, bool check_parent)
 Function sets switch hint state. More...
 
bool get_switch (opt_hints_enum type_arg) const
 Function returns switch hint state. More...
 
virtual const LEX_CSTRINGget_name () const
 
virtual const LEX_CSTRINGget_print_name ()
 
void set_name (const LEX_CSTRING *name_arg)
 
Opt_hintsget_parent () const
 
virtual void set_resolved ()
 
virtual bool is_resolved (opt_hints_enum type_arg)
 Returns 'resolved' flag value for depending on hint type. More...
 
virtual void set_unresolved (opt_hints_enum type_arg)
 Set hint to unresolved state. More...
 
virtual bool ignore_print (opt_hints_enum type_arg) const
 If ignore_print() returns true, hint is not printed in Opt_hints::print() function. More...
 
void incr_resolved_children ()
 
Mem_root_array< Opt_hints * > * child_array_ptr ()
 
bool is_all_resolved () const
 
void register_child (Opt_hints *hint_arg)
 
virtual PT_hintget_complex_hints (opt_hints_enum type)
 Returns pointer to complex hint for a given type. More...
 
Opt_hintsfind_by_name (const LEX_CSTRING *name_arg, const CHARSET_INFO *cs) const
 Find hint among lower-level hint objects. More...
 
void print (const THD *thd, String *str, enum_query_type query_type)
 Print all hints except of QB_NAME hint. More...
 
void check_unresolved (THD *thd)
 Check if there are any unresolved hint objects and print warnings for them. More...
 
virtual void append_name (const THD *thd, String *str)=0
 

Private Member Functions

void append_hint_type (String *str, opt_hints_enum type)
 Append hint type. More...
 
void print_warn_unresolved (THD *thd)
 Print warning for unresolved hint name. More...
 
virtual void print_irregular_hints (const THD *thd, String *str)
 Function prints hints which are non-standard and don't fit into existing hint infrastructure. More...
 

Private Attributes

const LEX_CSTRINGname
 
Opt_hintsparent
 
Opt_hints_map hints_map
 
Mem_root_array< Opt_hints * > child_array
 
bool resolved
 
uint resolved_children
 

Detailed Description

Opt_hints class is used as ancestor for Opt_hints_global, Opt_hints_qb, Opt_hints_table, Opt_hints_key classes.

Opt_hints_global class is hierarchical structure. It contains information about global hints and also contains array of QUERY BLOCK level objects (Opt_hints_qb class). Each QUERY BLOCK level object contains array of TABLE level hints (class Opt_hints_table). Each TABLE level hint contains array of KEY lelev hints (Opt_hints_key class). Hint information(specified, on|off state) is stored in hints_map object.

Constructor & Destructor Documentation

◆ Opt_hints()

Opt_hints::Opt_hints ( const LEX_CSTRING name_arg,
Opt_hints parent_arg,
MEM_ROOT mem_root_arg 
)
inline

◆ ~Opt_hints()

virtual Opt_hints::~Opt_hints ( )
virtualdefault

Member Function Documentation

◆ append_hint_type()

void Opt_hints::append_hint_type ( String str,
opt_hints_enum  type 
)
private

Append hint type.

Parameters
strPointer to String object
typeHint type

◆ append_name()

virtual void Opt_hints::append_name ( const THD thd,
String str 
)
pure virtual

◆ check_unresolved()

void Opt_hints::check_unresolved ( THD thd)

Check if there are any unresolved hint objects and print warnings for them.

Parameters
thdPointer to THD object

◆ child_array_ptr()

Mem_root_array< Opt_hints * > * Opt_hints::child_array_ptr ( )
inline

◆ find_by_name()

Opt_hints * Opt_hints::find_by_name ( const LEX_CSTRING name_arg,
const CHARSET_INFO cs 
) const

Find hint among lower-level hint objects.

Parameters
name_arghint name
csPointer to character set
Returns
hint if found, NULL otherwise

◆ get_complex_hints()

virtual PT_hint * Opt_hints::get_complex_hints ( opt_hints_enum  type)
inlinevirtual

Returns pointer to complex hint for a given type.

A complex hint is a hint that has arguments. (It is not just an on/off switch.)

Parameters
typehint type
Returns
pointer to complex hint for a given type.

Reimplemented in Opt_hints_global, Opt_hints_qb, and Opt_hints_table.

◆ get_name()

virtual const LEX_CSTRING * Opt_hints::get_name ( ) const
inlinevirtual

◆ get_parent()

Opt_hints * Opt_hints::get_parent ( ) const
inline

◆ get_print_name()

virtual const LEX_CSTRING * Opt_hints::get_print_name ( )
inlinevirtual

Reimplemented in Opt_hints_qb.

◆ get_switch()

bool Opt_hints::get_switch ( opt_hints_enum  type_arg) const

Function returns switch hint state.

Parameters
type_arghint type
Returns
hint value if hint is specified, false otherwise

◆ ignore_print()

virtual bool Opt_hints::ignore_print ( opt_hints_enum  type_arg) const
inlinevirtual

If ignore_print() returns true, hint is not printed in Opt_hints::print() function.

Atm used for INDEX_MERGE, SKIP_SCAN, INDEX, JOIN_INDEX, GROUP_INDEX ORDER_INDEX hints.

Parameters
type_arghint type
Returns
true if the hint should not be printed in Opt_hints::print() function, false otherwise.

Reimplemented in Opt_hints_key.

◆ incr_resolved_children()

void Opt_hints::incr_resolved_children ( )
inline

◆ is_all_resolved()

bool Opt_hints::is_all_resolved ( ) const
inline

◆ is_resolved()

virtual bool Opt_hints::is_resolved ( opt_hints_enum  type_arg)
inlinevirtual

Returns 'resolved' flag value for depending on hint type.

Parameters
type_arghint type
Returns
true if all hint objects are resolved, false otherwise.

Reimplemented in Opt_hints_table.

◆ is_specified()

bool Opt_hints::is_specified ( opt_hints_enum  type_arg) const
inline

◆ print()

void Opt_hints::print ( const THD thd,
String str,
enum_query_type  query_type 
)

Print all hints except of QB_NAME hint.

Parameters
thdPointer to THD object
strPointer to String object
query_typeIf query type is QT_NORMALIZED_FORMAT, un-resolved hints will also be printed

◆ print_irregular_hints()

virtual void Opt_hints::print_irregular_hints ( const THD thd,
String str 
)
inlineprivatevirtual

Function prints hints which are non-standard and don't fit into existing hint infrastructure.

Parameters
thdpointer to THD object
strpointer to String object

Reimplemented in Opt_hints_global, and Opt_hints_qb.

◆ print_warn_unresolved()

void Opt_hints::print_warn_unresolved ( THD thd)
private

Print warning for unresolved hint name.

Parameters
thdPointer to THD object

◆ register_child()

void Opt_hints::register_child ( Opt_hints hint_arg)
inline

◆ set_name()

void Opt_hints::set_name ( const LEX_CSTRING name_arg)
inline

◆ set_resolved()

virtual void Opt_hints::set_resolved ( )
inlinevirtual

Reimplemented in Opt_hints_table.

◆ set_switch()

bool Opt_hints::set_switch ( bool  switch_state_arg,
opt_hints_enum  type_arg,
bool  check_parent 
)
inline

Function sets switch hint state.

Parameters
switch_state_argswitch hint state
type_arghint type
check_parenttrue if hint can be on parent level
Returns
true if hint is already specified, false otherwise

◆ set_unresolved()

virtual void Opt_hints::set_unresolved ( opt_hints_enum  type_arg)
inlinevirtual

Set hint to unresolved state.

Parameters
type_arghint type

Reimplemented in Opt_hints_table.

Member Data Documentation

◆ child_array

Mem_root_array<Opt_hints *> Opt_hints::child_array
private

◆ hints_map

Opt_hints_map Opt_hints::hints_map
private

◆ name

const LEX_CSTRING* Opt_hints::name
private

◆ parent

Opt_hints* Opt_hints::parent
private

◆ resolved

bool Opt_hints::resolved
private

◆ resolved_children

uint Opt_hints::resolved_children
private

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