classJoining
final class Joining
Combines the two operands of a join: merged columns, the order * selects and NULL extension.
Rule: MYSQL-JOIN-COLUMNS-001. A LEFT join can extend the rows of its right operand with NULLs and a RIGHT join those of its left operand; the columns of an extended operand can be NULL in the occurrence and keep their declaration. Each column named by USING, and for a NATURAL join each column name both operands select with *, is merged: an unqualified name and * see one column, the column of the left operand, or of the right operand for a RIGHT join, which is the value COALESCE of both yields there; a qualified name still reaches the column of either operand. * selects the merged columns first, in the order of the operand they are taken from, then the other columns of that operand, then those of the other operand (a RIGHT join is read as the LEFT join of its swapped operands). A USING column that an operand certainly lacks, or selects twice, is reported. The common columns of a NATURAL join are not known while an operand has undeclared columns, so nothing is merged then. Source: https://dev.mysql.com/doc/refman/8.4/en/join.html ("Natural joins and joins with USING, including outer join variants, are processed according to the SQL:2003 standard"). Status: Implemented.
Methods§
public function join(
Derivation $derivation,
JoinedInput $left,
JoinedInput $right,
JoinedTable $join,
): JoinedInputJoins the right operand to the left one.
Parameters
$derivation | Derivation | |
$left | JoinedInput | |
$right | JoinedInput | |
$join | JoinedTable |
Returns
Called from 1
Calls 7
- function-call
countline 49 - method-call Joining::names() line 60
- method-call Joining::locate() line 61
- new VisibleRelation line 68
- function-call
array_valuesline 70 - method-call Joining::extend() line 76
- static-call JoinedInput::of() line 79
public function names(
Derivation $derivation,
JoinedTable $join,
JoinedInput $left,
JoinedInput $right,
): list<Name>Answers the names of the merged columns: the USING list, or for a natural join the names both operands select, in the order of the operand they are taken from.
Parameters
$derivation | Derivation | |
$join | JoinedTable | |
$left | JoinedInput | |
$right | JoinedInput |
Returns
list<Name>Called from 1
Calls 1
- method-call JoinedInput::complete() line 92
public function locate(
Derivation $derivation,
array<int, VisibleRelation> $visible,
list<array{int, int}> $star,
Name $name,
JoinedInput $operand,
): ?intFinds the star entry of an operand that a merged name denotes, reporting a name that is missing or selected twice.
Parameters
$derivation | Derivation | |
$visible | array<int, VisibleRelation> | |
$star | list<array{int, int}> | The star entries of the operand |
$name | Name | |
$operand | JoinedInput |
Returns
?intCalled from 2
Calls 6
- function-call
countline 130 - method-call Derivation::report() line 131
- new Misuse line 131
- class-const MisuseRule::AmbiguousJoinColumn() line 131
- method-call JoinedInput::complete() line 133
- new MissingColumn line 134
public function extend(VisibleRelation $relation): VisibleRelationMakes every column of a relation able to be NULL in the occurrence, keeping the slot it extends as its origin.
Parameters
$relation | VisibleRelation |
Returns
Test cases 1
Called from 2
Calls 4
- method-call Joining::nullable() line 147
- new ImplicitSlot line 151
- new VisibleRelation line 154
- new RowShape line 154
public function nullable(OutputSlot $slot): OutputSlotAnswers a slot that can be NULL, extending the given one.
Parameters
$slot | OutputSlot |
Returns
Test cases 2
Called from 2
Calls 2
- class-const Nullability::Nullable() line 162
- new OutputSlot line 162
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.