final class CandidateKeyMatch

Reads what a row carries in a candidate key, and tells when another row repeats it.

A candidate key only identifies a row when the row actually carries every column of it and carries something in each. SQL says a key with a null part collides with nothing, not even with itself, so a row that is missing a column or holds null there has no key values at all — which is a different answer from having key values that happen to be empty.

Type Aliases§

Row = import from TableDefinition

Methods§

public function of(Row $row, array<int, string> $columns): Row|null

Reads what a row carries in the named columns.

Parameters

$rowRowRow to read
$columnsarray<int, string>Columns the key is made of

Returns

Row|null The values, keyed by column, or null when the row cannot be identified by this key
Test cases 4
Called from 1
public function carriedBy(Row $values, Row $row): bool

Reports whether a row repeats these key values.

Parameters

$valuesRowKey values another row was read as carrying
$rowRowRow to test

Returns

bool True when the row carries every one of them identically
Test cases 2
Called from 1

Test cases 14§

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

Dedicated tests 6
Other tests reaching this symbol 8

Relations§

Instantiated in 1
Method calls 2
Type declarations 1