classRewriteRefusal
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
$config | ZtdConfig | What the caller said should happen |
public function forUnsupported(UnsupportedSqlException $refusal, string $sql): RewritePlanAnswers the plan for a statement ZTD cannot simulate.
Parameters
$refusal | UnsupportedSqlException | Why the rewriter would not take it |
$sql | string | Statement as it was written |
Returns
RewritePlan A plan that does nothing, where the caller allows thatThrows
DatabaseException When the caller asked to be told by being refusedTest cases 3
Called from 1
Calls 9
- method-call ZtdConfig::resolveUnsupportedBehavior() line 47
- class-const UnsupportedSqlBehavior::Exception() line 48
- new DatabaseException line 49
- method-call UnsupportedSqlException::getMessage() line 49
- class-const UnsupportedSqlBehavior::Notice() line 51
- function-call
trigger_errorline 52 - function-call
sprintfline 52 - new RewritePlan line 55
- class-const QueryKind::SKIPPED() line 55
public function forUnknownSchema(
UnknownSchemaException $refusal,
string $sql,
string $emptyResultSelect,
): RewritePlanAnswers the plan for a statement naming a table nothing declared.
Parameters
$refusal | UnknownSchemaException | Why the rewriter would not take it |
$sql | string | Statement as it was written |
$emptyResultSelect | string | Statement that reads nothing back, in the dialect at hand |
Returns
RewritePlan A plan that lets the statement through, or one that reads nothing backThrows
DatabaseException When the caller asked to be told by being refusedTest cases 4
RewriteRefusalTest::testForUnknownSchemaLetsTheStatementThroughWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnknownSchemaReadsNothingBackWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaSaysSomethingWhereTheCallerAskedToBeNoticedcalls
Called from 1
Calls 11
- method-call ZtdConfig::unknownSchemaBehavior() line 74
- class-const UnknownSchemaBehavior::Exception() line 75
- new DatabaseException line 76
- method-call UnknownSchemaException::getMessage() line 76
- class-const UnknownSchemaBehavior::Passthrough() line 78
- new RewritePlan line 79
- class-const QueryKind::READ() line 79
- class-const UnknownSchemaBehavior::Notice() line 81
- function-call
trigger_errorline 82 - function-call
sprintfline 83 - method-call UnknownSchemaException::getIdentifier() line 83
Private surface 1§
Implementation details, listed for orientation only.
private ZtdConfig $configTest cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
RewriteRefusalTest::testForUnknownSchemaLetsTheStatementThroughWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnknownSchemaReadsNothingBackWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaSaysSomethingWhereTheCallerAskedToBeNoticedcallsRewriteRefusalTest::testForUnsupportedAnswersAPlanThatDoesNothingWhereTheCallerAllowsThatcallsRewriteRefusalTest::testForUnsupportedRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnsupportedSaysSomethingWhereTheCallerAskedToBeNoticedcalls
Other tests reaching this symbol 2
SessionTestcallsStatementSimulatorTestcalls