classIndexHint
final class IndexHint
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One index hint of a table reference: USE|FORCE|IGNORE INDEX [FOR scope] (indexes).
USE accepts an empty list, which asks for no index; FORCE and IGNORE name at least one index. The names are not checked against declarations: the analysis context holds no indexes. Source: https://dev.mysql.com/doc/refman/8.4/en/index-hints.html.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t IGNORE KEY FOR GROUP BY (i, j)');
[$query->statement->from->indexHints[0]->action, count($query->statement->from->indexHints[0]->indexes)] // => [\SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHintAction::Ignore, 2]new \SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHint(\SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHintAction::Force, null, []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public list<Name|PrimaryIndex> $indexespublic IndexHintAction $actionpublic IndexHintScope|null $scopeMethods§
public function __construct(
public IndexHintAction $action,
public IndexHintScope|null $scope,
list<Name|Node> $indexes,
)Parameters
$action | IndexHintAction | What the hint asks |
$scope | IndexHintScope|null | The part of processing it applies to |
$indexes | list<Name|Node> | The indexes in written order, each a name or the primary key |
Calls 2
- static-call Check::input() line 47
- class-const IndexHintAction::Use() line 51
public function render(Output $out): voidWrites the hint.
Parameters
$out | Output |
Calls 8
- method-call Output::keyword() line 59
- class-const IndexHintScope::Join() line 62
- class-const IndexHintScope::OrderBy() line 63
- class-const IndexHintScope::GroupBy() line 64
- method-call Output::symbol() line 67
- method-call Output::name() line 73
- class-const NameUse::Alias() line 73
- method-call Output::node() line 75
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.