classDefaultRequest
final class DefaultRequest
implements Scalar
uses Snapshot
@visibility public.The keyword DEFAULT used as a value: the default of the column it is assigned to.
Mirrors the server's Item_default_value without an argument. The value means something only where a statement assigns it to a column: a row of INSERT or REPLACE, an assignment of SET, ON DUPLICATE KEY UPDATE, UPDATE or LOAD DATA.
Rule: MYSQL-DML-DEFAULT-001. The statement that assigns the value derives it at a position whose environment holds exactly one field, the column it is assigned to; the value has the type and nullability of that column, because the default is stored as a value of the column. Anywhere else, such as a row of a VALUES statement, the server rejects DEFAULT and the fact is that diagnostic. Terminates: no child. Source: https://dev.mysql.com/doc/refman/8.4/en/insert.html, https://dev.mysql.com/doc/refman/8.4/en/values.html. Status: Implemented.
$insert = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('INSERT INTO t (a) VALUES (DEFAULT)');
$insert->statement->rows[0]->values[0] instanceof \SqlSemantics\Platform\MySql\Statement\Dml\DefaultRequest // => trueMethods§
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the type and nullability of the column the value is assigned to.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- function-call
countline 49 - new ScalarFact line 50
- new WriteMisuse line 52
- class-const WriteRule::DefaultOutsideInsert() line 52
- method-call Derivation::report() line 53
- new Invalid line 55
- class-const Nullability::Dependent() line 55
public function render(Output $out): voidTest cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DefaultRequestTestcalls