classJoinRule
final class JoinRule
Lowers the table references and joins of the 5.x grammars.
Rule: MYSQL-JOIN-LEGACY-001. Scope: join_table_list, derived_table_list, esc_table_ref, table_ref, join_table, normal_join, opt_outer (5.x). The joins follow the parse, which nests conditionless joins to the left; a join on the left is walked in a loop. JOIN, INNER JOIN, CROSS JOIN and STRAIGHT_JOIN are kept as written, and so is OUTER. Constructs: JoinedTable, EscapedRelation. Terminates: the list and the left spine are walked in loops; recursion follows the strictly smaller right operands. Source: https://dev.mysql.com/doc/refman/5.7/en/join.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers the comma-separated references of a 5.x FROM clause in written order.
Parameters
$list | Node |
Returns
list<Relation>Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:148
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\JoinRule::list() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/JoinRule.php:77
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Shared\FromRule::members() packages/sql-semantics-mysql/src/Lowering/Query/Shared/FromRule.php:93
Calls 6
- method-call Lowering::form() line 75
- method-call JoinRule::list() line 77
- static-call ImplementationGap::production() line 80
- method-call Lists::items() line 83
- new Lists line 83
- method-call JoinRule::escaped() line 84
Lowers a reference with its optional ODBC escape.
Parameters
$reference | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 97
- method-call JoinRule::reference() line 100
- new EscapedRelation line 101
- static-call ImplementationGap::production() line 102
Lowers a table reference.
Parameters
$reference | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\JoinRule::escaped() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/JoinRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\JoinRule::escaped() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/JoinRule.php:101
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\JoinRule::joined() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/JoinRule.php:142
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\JoinRule::step() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/JoinRule.php:170
Calls 5
- method-call Lowering::form() line 113
- method-call FromRule::factor() line 116
- new FromRule line 116
- method-call JoinRule::joined() line 117
- static-call ImplementationGap::production() line 118
public function joined(Node $joined): JoinedTableLowers a join, walking the joins on its left in a loop.
Parameters
$joined | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- method-call Lowering::form() line 130
- class-const JoinRule::JOINS() line 132
- static-call ImplementationGap::production() line 133
- method-call JoinRule::reference() line 142
- function-call
array_reverseline 143 - method-call JoinRule::step() line 144
public function step(Relation $left, Form $form): JoinedTableLowers one join over an already lowered left operand.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 11
- class-const JoinRule::JOINS() line 156
- method-call Lowering::form() line 158
- method-call Form::node() line 158
- class-const JoinRule::NORMAL() line 159
- static-call ImplementationGap::production() line 159
- method-call FromRule::factor() line 170
- new FromRule line 170
- method-call JoinRule::reference() line 170
- new JoinedTable line 172
- method-call TableRule::names() line 177
- new TableRule line 177
Private surface 3§
Implementation details, listed for orientation only.
private const array<string, array{JoinOperator|null, int, int|null, int|null}> JOINS = ['join_table: table_ref normal_join table_ref' => [null, 2, null, null], 'join_…private const NORMAL = ['normal_join: JOIN_SYM' => \SqlSemantics\Platform\MySql\Statement\Relation\Joi…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
JoinRuleTestcalls
Relations§
Instantiated in 2
Method calls 2
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:148
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Shared\FromRule::members() packages/sql-semantics-mysql/src/Lowering/Query/Shared/FromRule.php:93