classTriggerAssignments
final class TriggerAssignments
Checks the assignments of SET to a column of the NEW or OLD row in a trigger body.
Rule: MYSQL-TRIGGER-ASSIGNMENT-001. In a trigger, a SET item without a scope keyword whose name is qualified by NEW or OLD, in any letter case, assigns to a column of the row of the trigger table. The OLD row cannot be changed (ER_TRG_CANT_CHANGE_ROW); a DELETE trigger has no NEW row (ER_TRG_NO_SUCH_ROW_IN_TRG); an AFTER trigger cannot change the NEW row (ER_TRG_CANT_CHANGE_ROW). Otherwise the name is resolved as a column of the NEW row, and a column the table does not have is reported (ER_BAD_FIELD_ERROR); a table that is not completely known reports nothing. The value is derived by the SET statement itself at the position of the body, where NEW and OLD are visible. Terminates: one pass over the items. Source: https://dev.mysql.com/doc/refman/8.4/en/trigger-syntax.html ("In a BEFORE trigger, you can also change its value with SET NEW.col_name
- = value"; "OLD columns are read only").
Status: Implemented.
Methods§
public function check(
SetVariables $set,
TriggerTime $time,
TriggerEvent $event,
Derivation $derivation,
ProgramScope $scope,
): voidChecks the items of a SET statement of a trigger body that assign to the NEW or OLD row.
Parameters
$set | SetVariables | |
$time | TriggerTime | |
$event | TriggerEvent | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 1
Calls 11
- function-call
strtoupperline 49 - new ProgramProblem line 51
- class-const ProgramRule::OldRowUpdate() line 51
- class-const TriggerEvent::Delete() line 53
- class-const ProgramRule::NoNewRow() line 53
- class-const TriggerTime::After() line 54
- class-const ProgramRule::AfterRowUpdate() line 54
- method-call Derivation::report() line 58
- method-call ColumnResolver::find() line 60
- new ColumnResolver line 60
- new QualifiedName line 60
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TriggerAssignmentsTestcalls