final class GenericExecuteResult
    implements ExecuteResult

Generic implementation of ExecuteResult.

This implementation handles all result types:

  • Passthrough: signals that original statement should be executed
  • Rewritten SELECT: wraps a StatementInterface for fetching
  • Simulated WRITE: buffers rows and provides iteration
  • Failure: represents execution failure

Type Aliases§

Row = import from TableDefinition

Methods§

public function __construct(
    bool $passthrough,
    bool $success,
    QueryKind $kind,
    ?StatementInterface $rewrittenStatement = null,
    array<int, Row>|null $bufferedRows = null,
    ?int $rowCountOverride = null,
    bool $resultSet = false,
)

Binds a result to everything it will answer from.

Every way of building one goes through a named constructor, because what a result is depends on which of them was used.

Parameters

$passthroughbool
$successbool
$kindQueryKind
$rewrittenStatement?StatementInterface
$bufferedRowsarray<int, Row>|null
$rowCountOverride?int
$resultSetbool
Calls 1
public static function fromBufferedRows(
    array<int, Row> $rows,
    QueryKind $kind = QueryKind::WRITE_SIMULATED,
    ?int $affectedRowCount = null,
    bool $hasResultSet = false,
): self

Create a result with buffered rows (for simulated WRITE queries).

Parameters

$rowsarray<int, Row>
$kindQueryKind
$affectedRowCount?int
$hasResultSetbool

Returns

self
Test cases 17
Called from 2
Calls 3
public static function fromStatementAndRows(
    StatementInterface $statement,
    array<int, Row> $rows,
    QueryKind $kind = QueryKind::WRITE_SIMULATED,
): self

Create a result with both a statement and buffered rows.

Parameters

$statementStatementInterface
$rowsarray<int, Row>
$kindQueryKind

Returns

self
Test cases 1
Calls 3
public function isPassthrough(): bool

{@inheritDoc}

Returns

bool
public function isSuccess(): bool

{@inheritDoc}

Returns

bool
public function kind(): QueryKind

{@inheritDoc}

Returns

public function fetch(): array|false

{@inheritDoc}

Returns

array|false
Calls 2
public function fetchAll(): array

{@inheritDoc}

Returns

array
Calls 2
public function rowCount(): int

{@inheritDoc}

Returns

int
public function hasResultSet(): bool

{@inheritDoc}

Returns

bool
Calls 1
public function resetBuffer(): void

Reset the buffer index for re-iteration.

Private surface 8§

Implementation details, listed for orientation only.

private bool $passthrough
private bool $success
private QueryKind $kind
private ?StatementInterface $rewrittenStatement
private ?RowSet $bufferedRows
private int $bufferIndex = 0
private ?int $rowCountOverride
private bool $resultSet

Test cases 29§

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

Dedicated tests 21
Other tests reaching this symbol 8

Relations§

Static calls 3