final class OptimizerHints
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Finds optimizer hint comments, which the parser delivers as trivia and no rule can read yet.

Rule: MYSQL-OPTIMIZER-HINTS-001. From MySQL 5.7.7 on, the server reads a comment that starts with /*+ and follows, after whitespace only, one of the keywords SELECT, INSERT, REPLACE, UPDATE or DELETE as a list of optimizer hints of the statement; a hint changes the request, for example SET_VAR or MAX_EXECUTION_TIME. The parser of this library has no hint grammar: the comment is part of the whitespace before the next token. A statement with such a comment therefore has a part no rule structures, and the lowering reports it as a missing rule instead of dropping it. In MySQL 5.6 the comment is an ordinary comment. Terminates: one iterative pass over the tokens. Source: https://dev.mysql.com/doc/refman/8.4/en/optimizer-hints.html. Status: Specified.

Methods§

public function first(Node $tree): ?string

Answers the first hint comment of a parse tree, or null when it has none.

Parameters

$treeNode

Returns

?string
Test cases 1
Called from 1
Calls 5

Private surface 1§

Implementation details, listed for orientation only.

private const KEYWORDS = ['SELECT_SYM' => true, 'INSERT' => true, 'INSERT_SYM' => true, 'REPLACE' => tru…

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Method calls 1