final class BufferedRow
Restricted visibility: declared "@visibility ZtdQuery\Adapter\Pdo". Code outside that scope must not name this declaration.

Shapes a row ZTD buffered into what a fetch mode asks for.

A simulated statement never reaches the driver, so nothing shapes its rows the way PDO's own fetch modes would. The rows come back keyed by column; this turns one of them into the array, list or object the caller asked to fetch.

Methods§

public function inMode<TValue>(
    array<string, TValue> $row,
    int $mode,
): array<int|string, TValue>|TValue|stdClass|false

Answers the row in the shape a fetch mode asks for.

A mode this does not know is read as PDO reads an unknown one: both ways at once, which is what PDO::FETCH_BOTH means.

Parameters

$rowarray<string, TValue>Row as ZTD buffered it, keyed by column
$modeintOne of PDO::FETCH_*

Returns

array<int|string, TValue>|TValue|stdClass|false The row or column selected by the fetch mode
Test cases 7
Called from 2
Calls 7
public function keyedBothWays<TValue>(array<string, TValue> $row): array<int|string, TValue>

Answers the row keyed by column name and by position at once.

Parameters

$rowarray<string, TValue>Row as ZTD buffered it, keyed by column

Returns

array<int|string, TValue> The same values, reachable under either key
Test cases 2
Called from 1
public function resolveMode(int $mode, int $connectionMode, ?int $statementMode): int

Resolve FETCH_DEFAULT using statement options before connection options.

Parameters

$modeint
$connectionModeint
$statementMode?int

Returns

int
Test cases 1
Called from 2
Calls 1
  • class-const PDO::FETCH_DEFAULT() line 72
public function fetch<TValue>(
    array<string, TValue>|false $row,
    int $mode,
): array<int|string, TValue>|TValue|stdClass|false

Shape a buffered row while preserving the exhausted-cursor marker.

Parameters

$rowarray<string, TValue>|false
$modeint

Returns

array<int|string, TValue>|TValue|stdClass|false
Test cases 1
Called from 1
Calls 1
public function all<TValue, TArgument>(
    array<int, array<string, TValue>> $rows,
    int $mode,
    array<TArgument> $arguments,
): list<array<int|string, TValue>|TValue|stdClass|false>

Shape all remaining rows, including column selection arguments.

Parameters

$rowsarray<int, array<string, TValue>>
$modeint
$argumentsarray<TArgument>

Returns

list<array<int|string, TValue>|TValue|stdClass|false>
Test cases 1
Called from 1
Calls 4
public function column<TValue>(array<string, TValue>|false $row, int $column): TValue|false

Read one positional column while preserving the exhausted-cursor marker.

Parameters

$rowarray<string, TValue>|false
$columnint

Returns

TValue|false
Test cases 1
Called from 2
Calls 1
public function object<TValue, TObject of object, TArgument>(
    array<string, TValue>|false $row,
    class-string<TObject>|null $class,
    array<TArgument> $constructorArgs,
): ($class is null ? stdClass : TObject)|false

Hydrate a buffered row after invoking its constructor.

Parameters

$rowarray<string, TValue>|false
$classclass-string<TObject>|null
$constructorArgsarray<TArgument>

Returns

($class is null ? stdClass : TObject)|false

Throws

ReflectionException When a declared property cannot be written.
Test cases 2
Called from 1
Calls 4
  • class-const stdClass::class() line 137
  • new ReflectionObject line 145
  • method-call ReflectionObject::hasProperty() line 147
  • method-call ReflectionObject::getProperty() line 148

Test cases 24§

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

Dedicated tests 15
Other tests reaching this symbol 9

Relations§

Instantiated in 1
Method calls 6
Type declarations 1