MCPcopy Create free account
hub / github.com/MariaDB/server / print_hints

Method print_hints

sql/sql_select.cc:32741–32778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32739}
32740
32741void st_select_lex::print_hints(THD *thd, String *str)
32742{
32743 if (!parent_lex->opt_hints_global)
32744 return;
32745
32746 const bool is_view= parent_lex->sql_command == SQLCOM_CREATE_VIEW ||
32747 parent_lex->sql_command == SQLCOM_SHOW_CREATE;
32748 constexpr LEX_CSTRING header={STRING_WITH_LEN("/*+ ")};
32749 str->append(header);
32750 const uint32 len_before_hints= str->length();
32751
32752 if (opt_hints_qb)
32753 opt_hints_qb->append_qb_hint(thd, str);
32754 if (this == parent_lex->unit.first_select() && !is_view)
32755 {
32756 /*
32757 For normal queries (not views creation/show) opt_hints_global will
32758 print itself and all children recursively into the first select.
32759 Global hints are not supported inside views, so it is safe to skip them
32760 */
32761 parent_lex->opt_hints_global->print(thd, str);
32762 }
32763 if (is_view && opt_hints_qb)
32764 {
32765 // For views print hints related to a QB right into the QB they target
32766 opt_hints_qb->print(thd, str);
32767 }
32768
32769 // If no hints were added, then rollback the previouly added header.
32770 if (str->length() <= len_before_hints)
32771 {
32772 str->length(len_before_hints - header.length);
32773 return;
32774 }
32775
32776 // Some hints were printed, close the hint string
32777 str->append(STRING_WITH_LEN("*/ "));
32778}
32779
32780/**
32781 Change the select_result object of the JOIN.

Callers

nothing calls this directly

Calls 5

append_qb_hintMethod · 0.80
first_selectMethod · 0.80
appendMethod · 0.45
lengthMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected