final class RewriteRefusal

What a session makes of a statement the rewriter would not take.

A rewriter refuses for two reasons: the statement is written in a way ZTD cannot simulate, or it names a table nothing declared. What should happen then is the caller's to say, and they say it in the configuration — raise it, say something and carry on, or let the statement through untouched — so turning a refusal into a plan is a question of configuration and not of rewriting.

Methods§

public function __construct(private ZtdConfig $config)

Parameters

$configZtdConfigWhat the caller said should happen
public function forUnsupported(UnsupportedSqlException $refusal, string $sql): RewritePlan

Answers the plan for a statement ZTD cannot simulate.

Parameters

$refusalUnsupportedSqlExceptionWhy the rewriter would not take it
$sqlstringStatement as it was written

Returns

RewritePlan A plan that does nothing, where the caller allows that

Throws

DatabaseException When the caller asked to be told by being refused
Test cases 3
Called from 1
Calls 9
public function forUnknownSchema(
    UnknownSchemaException $refusal,
    string $sql,
    string $emptyResultSelect,
): RewritePlan

Answers the plan for a statement naming a table nothing declared.

Parameters

$refusalUnknownSchemaExceptionWhy the rewriter would not take it
$sqlstringStatement as it was written
$emptyResultSelectstringStatement that reads nothing back, in the dialect at hand

Returns

RewritePlan A plan that lets the statement through, or one that reads nothing back

Throws

DatabaseException When the caller asked to be told by being refused
Test cases 4
Called from 1
Calls 11

Private surface 1§

Implementation details, listed for orientation only.

private ZtdConfig $config

Test cases 9§

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

Dedicated tests 7
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 2
Type declarations 1