classMultipleDelete
final class MultipleDelete
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.DELETE from several tables: the tables rows are deleted from, the table references that find the rows, and WHERE.
Each table to delete from names a table of the references, by its correlation name when it has one. The facts follow MYSQL-DELETE-001. Source: https://dev.mysql.com/doc/refman/8.4/en/delete.html.
$delete = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('DELETE t.* , u FROM t JOIN u ON t.a = u.a WHERE t.b = 1');
[count($delete->statement->targets), $delete->toString()] // => [2, 'DELETE t, u FROM t JOIN u ON t.a = u.a WHERE t.b = 1']Properties§
public list<DeleteOption> $optionspublic list<QualifiedName> $targetspublic list<Relation> $tablespublic WithClause|null $withpublic MultipleDeleteForm $formpublic Scalar|null $where = nullMethods§
public function __construct(
public WithClause|null $with,
list<DeleteOption> $options,
list<QualifiedName> $targets,
public MultipleDeleteForm $form,
list<Relation> $tables,
public Scalar|null $where = null,
)Parameters
$with | WithClause|null | The common tables (MySQL 8.0 and later) |
$options | list<DeleteOption> | The modifiers |
$targets | list<QualifiedName> | The tables rows are deleted from; at least one |
$form | MultipleDeleteForm | Where the tables to delete from are written |
$tables | list<Relation> | The table references; at least one |
$where | Scalar|null | The row predicate |
Throws
InvalidConstruction When there is no table to delete from or no table referenceCalls 5
- static-call Check::listOf() line 68
- class-const DeleteOption::class() line 68
- class-const QualifiedName::class() line 69
- static-call Check::input() line 71
- class-const Relation::class() line 73
public function deriveStatement(Derivation $derivation): voidDerives the table references, the tables to delete from and WHERE; the statement returns no rows.
Parameters
$derivation | Derivation |
Calls 3
- method-call ChangeFacts::deleteMultiple() line 81
- new ChangeFacts line 81
- method-call Derivation::environment() line 81
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 7
- method-call Output::node() line 89
- method-call Output::keyword() line 91
- class-const MultipleDeleteForm::Using() line 93
- method-call Output::symbol() line 98
- method-call Output::name() line 101
- class-const NameUse::Qualifier() line 101
- class-const NameUse::Relation() line 103
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 3
- new SqlSemantics\Platform\MySql\Lowering\Dml\ChangeRule::delete() packages/sql-semantics-mysql/src/Lowering/Dml/ChangeRule.php:119
- new SqlSemantics\Platform\MySql\Lowering\Dml\ChangeRule::legacyDelete() packages/sql-semantics-mysql/src/Lowering/Dml/ChangeRule.php:152
- new SqlSemantics\Platform\MySql\Lowering\Dml\ChangeRule::legacyDelete() packages/sql-semantics-mysql/src/Lowering/Dml/ChangeRule.php:153