classMutationImpact
final class MutationImpact
Derives observable execution metadata from a shadow-state transition.
Type Aliases§
Row = import from TableDefinitionMethods§
public function __construct(
private ShadowMutation $mutation,
array<int, Row> $before,
array<int, Row> $input,
array<int, Row> $after,
private RowMultiset $rows = new \ZtdQuery\Shadow\Row\RowMultiset(),
private MutationRowIdentity $identity = new \ZtdQuery\Shadow\Mutation\MutationRowIdentity(),
)Parameters
$mutation | ShadowMutation | The statement whose effect this reports |
$before | array<int, Row> | The table as it stood |
$input | array<int, Row> | The rows the statement was given |
$after | array<int, Row> | The table as it stands now |
$rows | RowMultiset | Accounts for rows that repeat |
$identity | MutationRowIdentity | Takes the carried names back off a row |
Test cases 16
MutationImpactTest::testAffectedRowCountIsNothingWhereTheStatementReportsNonecoversMutationImpactTest::testAppliedUpsertReturnsResultRowsAndIsInsertLikecoversMutationImpactTest::testIgnoredInsertHasNoReturningRowscoversMutationImpactTest::testImpactPreservesEveryChangedRowAndDuplicateMultiplicitycoversMutationImpactTest::testInsertImpactContainsOnlyRowsActuallyAddedcoversMutationImpactTest::testIsInsertLikeIsFalseForAStatementThatOnlyRemovesRowscoversMutationImpactTest::testNoneModeHidesInternalMigrationRowscoversMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecoversMutationImpactTest::testReplaceIsInsertLikecoversMutationImpactTest::testReturningDeleteRowsComeFromMutationInputcoversMutationImpactTest::testReturningRowsAnswersTheRowsAStatementWouldReadBackcoversMutationImpactTest::testReturningRowsPreserveSparseInputKeyscoversMutationImpactTest::testReturningUpdateRowsExcludeInternalIdentityMetadatacoversMutationImpactTest::testRowsWithDifferentColumnsOrValuesAreChangedcoversMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscoversMutationImpactTest::testSynchronizationCountsMixedOperationsOnceEachcovers
Calls 3
- new RowMultiset line 41
- new MutationRowIdentity line 42
- new RowSet line 44
public function affectedRowCount(AffectedRowsMode $mode): intAffected row count.
Parameters
$mode | AffectedRowsMode |
Returns
intTest cases 9
MutationImpactTest::testAffectedRowCountIsNothingWhereTheStatementReportsNonecovers and callsMutationImpactTest::testAppliedUpsertReturnsResultRowsAndIsInsertLikecovers and callsMutationImpactTest::testImpactPreservesEveryChangedRowAndDuplicateMultiplicitycovers and callsMutationImpactTest::testInsertImpactContainsOnlyRowsActuallyAddedcovers and callsMutationImpactTest::testNoneModeHidesInternalMigrationRowscovers and callsMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecovers and callsMutationImpactTest::testRowsWithDifferentColumnsOrValuesAreChangedcovers and callsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscovers and callsMutationImpactTest::testSynchronizationCountsMixedOperationsOnceEachcovers and calls
Calls 8
- class-const AffectedRowsMode::None() line 57
- class-const AffectedRowsMode::Matched() line 60
- function-call
countline 61 - method-call ShadowMutation::resultRows() line 61
- class-const AffectedRowsMode::Changed() line 66
- method-call ShadowMutation::affectedRowCount() line 67
- function-call
maxline 70 - method-call RowMultiset::difference() line 71
public function returningRows(): array<int, Row>Returns
array<int, Row>Test cases 10
MutationImpactTest::testAppliedUpsertReturnsResultRowsAndIsInsertLikecovers and callsMutationImpactTest::testIgnoredInsertHasNoReturningRowscovers and callsMutationImpactTest::testImpactPreservesEveryChangedRowAndDuplicateMultiplicitycovers and callsMutationImpactTest::testInsertImpactContainsOnlyRowsActuallyAddedcovers and callsMutationImpactTest::testReplaceIsInsertLikecovers and callsMutationImpactTest::testReturningDeleteRowsComeFromMutationInputcovers and callsMutationImpactTest::testReturningRowsAnswersTheRowsAStatementWouldReadBackcovers and callsMutationImpactTest::testReturningRowsPreserveSparseInputKeyscovers and callsMutationImpactTest::testReturningUpdateRowsExcludeInternalIdentityMetadatacovers and callsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscovers and calls
Called from 1
Calls 3
- method-call MutationRowIdentity::stripAll() line 82
- method-call ShadowMutation::resultRows() line 82
- method-call RowMultiset::difference() line 88
public function isInsertLike(): boolReports whether insert like.
Returns
boolTest cases 7
MutationImpactTest::testAppliedUpsertReturnsResultRowsAndIsInsertLikecovers and callsMutationImpactTest::testInsertImpactContainsOnlyRowsActuallyAddedcovers and callsMutationImpactTest::testIsInsertLikeIsFalseForAStatementThatOnlyRemovesRowscovers and callsMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecovers and callsMutationImpactTest::testReplaceIsInsertLikecovers and callsMutationImpactTest::testReturningDeleteRowsComeFromMutationInputcovers and callsMutationImpactTest::testSynchronizationCountsMixedOperationsOnceEachcovers and calls
Private surface 6§
Implementation details, listed for orientation only.
private RowSet $beforeprivate RowSet $inputprivate RowSet $afterprivate ShadowMutation $mutationprivate RowMultiset $rows = new \ZtdQuery\Shadow\Row\RowMultiset()private MutationRowIdentity $identity = new \ZtdQuery\Shadow\Mutation\MutationRowIdentity()Test cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 16
MutationImpactTest::testAffectedRowCountIsNothingWhereTheStatementReportsNonecovers and callsMutationImpactTest::testAppliedUpsertReturnsResultRowsAndIsInsertLikecovers and callsMutationImpactTest::testIgnoredInsertHasNoReturningRowscovers and callsMutationImpactTest::testImpactPreservesEveryChangedRowAndDuplicateMultiplicitycovers and callsMutationImpactTest::testInsertImpactContainsOnlyRowsActuallyAddedcovers and callsMutationImpactTest::testIsInsertLikeIsFalseForAStatementThatOnlyRemovesRowscovers and callsMutationImpactTest::testNoneModeHidesInternalMigrationRowscovers and callsMutationImpactTest::testNoOpUpdateUsesPlatformRowCountModecovers and callsMutationImpactTest::testReplaceIsInsertLikecovers and callsMutationImpactTest::testReturningDeleteRowsComeFromMutationInputcovers and callsMutationImpactTest::testReturningRowsAnswersTheRowsAStatementWouldReadBackcovers and callsMutationImpactTest::testReturningRowsPreserveSparseInputKeyscovers and callsMutationImpactTest::testReturningUpdateRowsExcludeInternalIdentityMetadatacovers and callsMutationImpactTest::testRowsWithDifferentColumnsOrValuesAreChangedcovers and callsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscovers and callsMutationImpactTest::testSynchronizationCountsMixedOperationsOnceEachcovers and calls
Other tests reaching this symbol 3
SessionTestcallsShadowApplicationTestcallsStatementSimulatorTestcalls
Relations§
Instantiated in 1
Method calls 3
- method-call ZtdQuery\Shadow\ShadowApplication::apply() packages/ztd-query-core/src/Shadow/ShadowApplication.php:85
- method-call ZtdQuery\Shadow\ShadowApplication::lastInsertIdOf() packages/ztd-query-core/src/Shadow/ShadowApplication.php:106
- method-call ZtdQuery\Shadow\ShadowApplication::lastInsertIdOf() packages/ztd-query-core/src/Shadow/ShadowApplication.php:116