classUpsertExpression
final class UpsertExpression
A scalar expression from an UPSERT assignment, in no particular dialect.
Every dialect writes "the value that was already there" and "the value that
- was coming in" differently, so a parser reads its own spelling and builds one
of these; what the expression means is then worked out here, once, for all of them. What each operator means is left to the collaborator that owns it, so this is only the tree and the walk over it.
Type Aliases§
Row = import from TableDefinitionRowValue = import from TableDefinitionMethods§
public function __construct(
private UpsertExpressionKind $kind,
private UpsertLiteralSource $literal = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertLiteral(null),
private UpsertColumnSource|null $columnSource = null,
private string|null $column = null,
private list<self> $operands = [],
private UpsertColumn $columns = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertColumn(),
private UpsertTruth $truth = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertTruth(),
private UpsertOperator $operators = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator(),
)Parameters
$kind | UpsertExpressionKind | What this node is |
$literal | UpsertLiteralSource | Value a literal stands for |
$columnSource | UpsertColumnSource|null | Which row a column is read from |
$column | string|null | Column a column node names |
$operands | list<self> | Nodes this one is written over |
$columns | UpsertColumn | Reads a column off a row |
$truth | UpsertTruth | Answers what counts as true |
$operators | UpsertOperator | Says what an operator stands for |
Test cases 45
UpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcoversUpsertExpressionTest::testArithmeticFloatingPointBoundariescoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testColumnReadsTheSelectedRowAndColumncoversUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcoversUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescoversUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecoversUpsertExpressionTest::testLiteralPreservesAnOpaqueCallerValuecoversUpsertExpressionTest::testMatchesIsTrueOnlyWhereTheExpressionDefinitelyHoldscoversUpsertExpressionTest::testOperandRefusesAColumnTheRowDoesNotCarrycoversUpsertExpressionTest::testRejectsDivisionByZerocoversUpsertExpressionTest::testRejectsModuloByZerocoversUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcoversUpsertExpressionTest::testRejectsNumericAndTextComparisoncoversUpsertExpressionTest::testThreeValuedBooleanBoundariescoversUpsertExpressionTest::testUnaryNegatesTheOperandcovers
Calls 4
- new UpsertLiteral line 42
- new UpsertColumn line 46
- new UpsertTruth line 47
- new UpsertOperator line 48
public static function literal(mixed $value): selfBuilds an expression standing for a value written into the statement.
Parameters
$value | mixed | Value as the statement wrote it |
Returns
self The expressionTest cases 60
ConflictSearchTest::testOfIsNothingWhereTheIncomingRowTakesNoPartInTheNarrowedKeycallsConflictSearchTest::testOfLeavesOutTheRowsAlreadyThereThatTakeNoPartcallsConflictSearchTest::testOfReportsTheRowUnderTheKeyTheCallerKnowsItBycallsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscallsInsertMutationTest::testInsertIgnoreUsesPartialConflictPredicatecallsUpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcovers and callsUpsertExpressionTest::testArithmeticFloatingPointBoundariescovers and callsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperandscallsUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcovers and callsUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescovers and callsUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecovers and callsUpsertExpressionTest::testLiteralPreservesAnOpaqueCallerValuecovers and callsUpsertExpressionTest::testMatchesIsTrueOnlyWhereTheExpressionDefinitelyHoldscovers and callsUpsertExpressionTest::testRejectsDivisionByZerocovers and callsUpsertExpressionTest::testRejectsModuloByZerocovers and callsUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcovers and callsUpsertExpressionTest::testRejectsNumericAndTextComparisoncovers and callsUpsertExpressionTest::testThreeValuedBooleanBoundariescovers and callsUpsertExpressionTest::testUnaryNegatesTheOperandcovers and callsUpsertMutationTest::testApplyUsesConflictPredicateAndReportsOnlyAppliedRowscallsUpsertMutationTest::testApplyWithLiteralUpdateValuecallsUpsertMutationTest::testConflictPredicateRestrictsIncomingAndExistingCandidateRowscallsUpsertMutationTest::testDatabaseEvaluatedPredicateFallsBackWhenMetadataIsMissingcallsUpsertMutationTest::testResultRowsAnswersEveryRowTheStatementWroteOrLeftAsItWascallsUpsertMutationTest::testSkippedConditionalRowDoesNotStopFollowingRowscallsUpsertUpdateTest::testAppliesReadsTheConditionHereWhereTheDatabaseWorkedNothingOutcallsUpsertUpdateTest::testValueReadAnswersTheAssignmentZtdReadcallsUpsertUpdateTest::testWithColumnReadsTheExpressionAgainstTheRowAsTheStatementLeftItcalls
Calls 3
- new
selfline 61 - class-const UpsertExpressionKind::Literal() line 61
- new UpsertLiteral line 61
public static function column(UpsertColumnSource $source, string $column): selfBuilds an expression standing for a column of one of the two rows.
Parameters
$source | UpsertColumnSource | Whether the column is read from the existing row or the incoming one |
$column | string | Column as the statement named it |
Returns
self The expressionThrows
InvalidDefinitionException When no column was namedTest cases 22
ConflictSearchTest::testOfIsNothingWhereTheIncomingRowTakesNoPartInTheNarrowedKeycallsConflictSearchTest::testOfLeavesOutTheRowsAlreadyThereThatTakeNoPartcallsConflictSearchTest::testOfReportsTheRowUnderTheKeyTheCallerKnowsItBycallsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscallsInsertMutationTest::testInsertIgnoreUsesPartialConflictPredicatecallsUpsertExpressionTest::testColumnReadsTheSelectedRowAndColumncovers and callsUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescovers and callsUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecovers and callsUpsertExpressionTest::testOperandRefusesAColumnTheRowDoesNotCarrycovers and callsUpsertMutationTest::testApplyAccumulatesExistingAndIncomingValuescallsUpsertMutationTest::testApplyAccumulatesSequentialConflictsAgainstLatestRowcallsUpsertMutationTest::testApplyUpdatesExistingRowOnUniqueKeyConflictcallsUpsertMutationTest::testApplyUsesConflictPredicateAndReportsOnlyAppliedRowscallsUpsertMutationTest::testApplyWithExcludedColumnReferencecallsUpsertMutationTest::testApplyWithExcludedQuotedColumnReferencecallsUpsertMutationTest::testApplyWithUpdateValuesExpressioncallsUpsertMutationTest::testConflictPredicateRestrictsIncomingAndExistingCandidateRowscallsUpsertMutationTest::testDatabaseEvaluatedBatchDetectsConflictsWithRowsInsertedEarlierInStatementcallsUpsertMutationTest::testDatabaseEvaluatedBatchReevaluatesAgainstLatestConflictRowcallsUpsertMutationTest::testDatabaseEvaluatedPredicateFallsBackWhenMetadataIsMissingcallsUpsertMutationTest::testSkippedConditionalRowDoesNotStopFollowingRowscallsUpsertUpdateTest::testWithColumnReadsTheExpressionAgainstTheRowAsTheStatementLeftItcalls
Calls 3
- new InvalidDefinitionException line 77
- new
selfline 80 - class-const UpsertExpressionKind::Column() line 80
public static function unary(UpsertExpressionKind $kind, self $operand): selfBuilds an expression written over one other.
Parameters
$kind | UpsertExpressionKind | Operator to apply |
$operand | self | Expression it is applied to |
Returns
self The expressionThrows
InvalidDefinitionException When the operator is not one written over a single operandTest cases 3
Calls 6
- function-call
in_arrayline 95 - class-const UpsertExpressionKind::UnaryPlus() line 96
- class-const UpsertExpressionKind::UnaryMinus() line 97
- class-const UpsertExpressionKind::Not() line 98
- new InvalidDefinitionException line 100
- new
selfline 103
public static function binary(UpsertExpressionKind $kind, self $left, self $right): selfBuilds an expression written between two others.
Parameters
$kind | UpsertExpressionKind | Operator to apply |
$left | self | Expression on its left |
$right | self | Expression on its right |
Returns
self The expressionThrows
InvalidDefinitionException When the operator is not one written between two operandsTest cases 58
ConflictSearchTest::testOfIsNothingWhereTheIncomingRowTakesNoPartInTheNarrowedKeycallsConflictSearchTest::testOfLeavesOutTheRowsAlreadyThereThatTakeNoPartcallsConflictSearchTest::testOfReportsTheRowUnderTheKeyTheCallerKnowsItBycallsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscallsInsertMutationTest::testInsertIgnoreUsesPartialConflictPredicatecallsUpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcovers and callsUpsertExpressionTest::testArithmeticFloatingPointBoundariescovers and callsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperandscallsUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcovers and callsUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescovers and callsUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecovers and callsUpsertExpressionTest::testRejectsDivisionByZerocovers and callsUpsertExpressionTest::testRejectsModuloByZerocovers and callsUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcovers and callsUpsertExpressionTest::testRejectsNumericAndTextComparisoncovers and callsUpsertExpressionTest::testThreeValuedBooleanBoundariescovers and callsUpsertMutationTest::testApplyAccumulatesExistingAndIncomingValuescallsUpsertMutationTest::testApplyAccumulatesSequentialConflictsAgainstLatestRowcallsUpsertMutationTest::testApplyUsesConflictPredicateAndReportsOnlyAppliedRowscallsUpsertMutationTest::testConflictPredicateRestrictsIncomingAndExistingCandidateRowscallsUpsertMutationTest::testDatabaseEvaluatedBatchDetectsConflictsWithRowsInsertedEarlierInStatementcallsUpsertMutationTest::testDatabaseEvaluatedBatchReevaluatesAgainstLatestConflictRowcallsUpsertMutationTest::testDatabaseEvaluatedPredicateFallsBackWhenMetadataIsMissingcallsUpsertMutationTest::testSkippedConditionalRowDoesNotStopFollowingRowscallsUpsertUpdateTest::testAppliesReadsTheConditionHereWhereTheDatabaseWorkedNothingOutcallsUpsertUpdateTest::testWithColumnReadsTheExpressionAgainstTheRowAsTheStatementLeftItcalls
Calls 8
- function-call
in_arrayline 119 - class-const UpsertExpressionKind::Literal() line 120
- class-const UpsertExpressionKind::Column() line 121
- class-const UpsertExpressionKind::UnaryPlus() line 122
- class-const UpsertExpressionKind::UnaryMinus() line 123
- class-const UpsertExpressionKind::Not() line 124
- new InvalidDefinitionException line 126
- new
selfline 129
Answers what the expression stands for, against the two rows in play.
Parameters
Returns
mixed The value the expression stands forThrows
UnsupportedSqlException When an operand is not something the operator can be applied toTest cases 46
UpsertLiteralSourceTest::testValueFlowsIntoAnExpressionWithoutCoercioncallsUpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcoversUpsertExpressionTest::testArithmeticFloatingPointBoundariescoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testColumnReadsTheSelectedRowAndColumncoversUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcoversUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescoversUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecoversUpsertExpressionTest::testLiteralPreservesAnOpaqueCallerValuecoversUpsertExpressionTest::testMatchesIsTrueOnlyWhereTheExpressionDefinitelyHoldscoversUpsertExpressionTest::testOperandRefusesAColumnTheRowDoesNotCarrycoversUpsertExpressionTest::testRejectsDivisionByZerocoversUpsertExpressionTest::testRejectsModuloByZerocoversUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcoversUpsertExpressionTest::testRejectsNumericAndTextComparisoncoversUpsertExpressionTest::testThreeValuedBooleanBoundariescoversUpsertExpressionTest::testUnaryNegatesTheOperandcovers
Called from 1
Calls 8
- class-const UpsertExpressionKind::Literal() line 145
- method-call UpsertLiteralSource::value() line 146
- class-const UpsertExpressionKind::Column() line 148
- method-call UpsertColumn::of() line 149
- class-const UpsertColumnSource::Incoming() line 150
- method-call UpsertOperator::apply() line 155
- method-call UpsertExpression::operand() line 157
- function-call
countline 158
Reports whether the expression holds, as a condition would have to.
Unknown is not enough: a WHERE that cannot be shown to hold does not select the row, so only a definite true counts.
Parameters
Returns
bool True when the expression is definitely trueThrows
UnsupportedSqlException When an operand is not something the operator can be applied toTest cases 2
Calls 2
- method-call UpsertTruth::of() line 178
- method-call UpsertExpression::evaluate() line 178
public function operand(
int $index,
Row $existingRow,
Row $incomingRow,
string $tableName,
): mixedAnswers what one of the operands stands for.
Parameters
Returns
mixed The value that operand stands forThrows
UnsupportedSqlException When an operand is not something the operator can be applied toTest cases 42
UpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcoversUpsertExpressionTest::testArithmeticFloatingPointBoundariescoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcoversUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescoversUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecoversUpsertExpressionTest::testMatchesIsTrueOnlyWhereTheExpressionDefinitelyHoldscoversUpsertExpressionTest::testRejectsDivisionByZerocoversUpsertExpressionTest::testRejectsModuloByZerocoversUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcoversUpsertExpressionTest::testRejectsNumericAndTextComparisoncoversUpsertExpressionTest::testThreeValuedBooleanBoundariescoversUpsertExpressionTest::testUnaryNegatesTheOperandcovers
Private surface 8§
Implementation details, listed for orientation only.
private UpsertExpressionKind $kindprivate UpsertLiteralSource $literal = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertLiteral(null)private UpsertColumnSource|null $columnSource = nullprivate string|null $column = nullprivate list<self> $operands = []private UpsertColumn $columns = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertColumn()private UpsertTruth $truth = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertTruth()private UpsertOperator $operators = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator()Test cases 71§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 48
UpsertExpressionTest::testAcceptsFloatingPointOneAsDivisorcovers and callsUpsertExpressionTest::testArithmeticFloatingPointBoundariescovers and callsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheLeftOperandIsNull#subtractcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNullcallsUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#addcoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#dividecoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#modulocoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#multiplycoversUpsertExpressionTest::testArithmeticIsNullWhereTheRightOperandIsNull#subtractcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperandscallsUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#and rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#dividecoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greatercoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#greater or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#lesscoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#less or equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#modulocoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#multiplycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equalcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#not equal boundarycoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or leftcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#or rightcoversUpsertExpressionTest::testBinaryAnswersWhatTheOperatorMakesOfItsTwoOperands#subtractcoversUpsertExpressionTest::testColumnReadsTheSelectedRowAndColumncovers and callsUpsertExpressionTest::testComparisonReturnsNullWhenEitherOperandIsNullcovers and callsUpsertExpressionTest::testEvaluatesNullNumericTextAndCaseInsensitiveColumnBoundariescovers and callsUpsertExpressionTest::testLiteralAnswersTheValueTheStatementWrotecovers and callsUpsertExpressionTest::testLiteralPreservesAnOpaqueCallerValuecovers and callsUpsertExpressionTest::testMatchesIsTrueOnlyWhereTheExpressionDefinitelyHoldscovers and callsUpsertExpressionTest::testOperandRefusesAColumnTheRowDoesNotCarrycovers and callsUpsertExpressionTest::testRejectsDivisionByZerocovers and callsUpsertExpressionTest::testRejectsModuloByZerocovers and callsUpsertExpressionTest::testRejectsNonNumericArithmeticOperandcovers and callsUpsertExpressionTest::testRejectsNumericAndTextComparisoncovers and callsUpsertExpressionTest::testThreeValuedBooleanBoundariescovers and callsUpsertExpressionTest::testUnaryNegatesTheOperandcovers and calls
Other tests reaching this symbol 23
ConflictSearchTest::testOfIsNothingWhereTheIncomingRowTakesNoPartInTheNarrowedKeycallsConflictSearchTest::testOfLeavesOutTheRowsAlreadyThereThatTakeNoPartcallsConflictSearchTest::testOfReportsTheRowUnderTheKeyTheCallerKnowsItBycallsMutationImpactTest::testSkippedConditionalUpsertHasNoAffectedOrReturningRowscallsInsertMutationTest::testInsertIgnoreUsesPartialConflictPredicatecallsUpsertLiteralSourceTest::testValueFlowsIntoAnExpressionWithoutCoercioncallsUpsertMutationTest::testApplyAccumulatesExistingAndIncomingValuescallsUpsertMutationTest::testApplyAccumulatesSequentialConflictsAgainstLatestRowcallsUpsertMutationTest::testApplyUpdatesExistingRowOnUniqueKeyConflictcallsUpsertMutationTest::testApplyUsesConflictPredicateAndReportsOnlyAppliedRowscallsUpsertMutationTest::testApplyWithExcludedColumnReferencecallsUpsertMutationTest::testApplyWithExcludedQuotedColumnReferencecallsUpsertMutationTest::testApplyWithLiteralUpdateValuecallsUpsertMutationTest::testApplyWithUpdateValuesExpressioncallsUpsertMutationTest::testConflictPredicateRestrictsIncomingAndExistingCandidateRowscallsUpsertMutationTest::testDatabaseEvaluatedBatchDetectsConflictsWithRowsInsertedEarlierInStatementcallsUpsertMutationTest::testDatabaseEvaluatedBatchReevaluatesAgainstLatestConflictRowcallsUpsertMutationTest::testDatabaseEvaluatedPredicateFallsBackWhenMetadataIsMissingcallsUpsertMutationTest::testResultRowsAnswersEveryRowTheStatementWroteOrLeftAsItWascallsUpsertMutationTest::testSkippedConditionalRowDoesNotStopFollowingRowscallsUpsertUpdateTest::testAppliesReadsTheConditionHereWhereTheDatabaseWorkedNothingOutcallsUpsertUpdateTest::testValueReadAnswersTheAssignmentZtdReadcallsUpsertUpdateTest::testWithColumnReadsTheExpressionAgainstTheRowAsTheStatementLeftItcalls
Relations§
Type declarations 10
- type ZtdQuery\Shadow\Mutation\ConflictSearch packages/ztd-query-core/src/Shadow/Mutation/ConflictSearch.php:30
- type ZtdQuery\Shadow\Mutation\Row\InsertMutation packages/ztd-query-core/src/Shadow/Mutation/Row/InsertMutation.php:60
- type ZtdQuery\Shadow\Mutation\Row\InsertMutation packages/ztd-query-core/src/Shadow/Mutation/Row/InsertMutation.php:84
- type ZtdQuery\Shadow\Mutation\UpsertMutation packages/ztd-query-core/src/Shadow/Mutation/UpsertMutation.php:50
- type ZtdQuery\Shadow\Mutation\UpsertMutation packages/ztd-query-core/src/Shadow/Mutation/UpsertMutation.php:52
- type ZtdQuery\Shadow\Mutation\UpsertMutation packages/ztd-query-core/src/Shadow/Mutation/UpsertMutation.php:82
- type ZtdQuery\Shadow\Mutation\UpsertMutation packages/ztd-query-core/src/Shadow/Mutation/UpsertMutation.php:86
- type ZtdQuery\Shadow\Mutation\UpsertUpdate packages/ztd-query-core/src/Shadow/Mutation/UpsertUpdate.php:43
- type ZtdQuery\Shadow\Mutation\UpsertUpdate packages/ztd-query-core/src/Shadow/Mutation/UpsertUpdate.php:190
- type ZtdQuery\Shadow\Mutation\UpsertUpdate packages/ztd-query-core/src/Shadow/Mutation/UpsertUpdate.php:209