classTruncateTable
final class TruncateTable
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.TRUNCATE [TABLE] t: a request to remove every row of a table.
Mirrors PT_truncate_table_stmt. Rule: MYSQL-TRUNCATE-001. The name resolves by MYSQL-CHANGE-TARGET-001 and its resolution is the relation fact of the statement node; a declared view is refused (MYSQL-RELATION-KIND-001). The statement changes no declaration and provides none. The word TABLE is optional and always written. Source: https://dev.mysql.com/doc/refman/8.4/en/truncate-table.html. Status: Implemented.
$truncate = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('TRUNCATE shop.t');
[$truncate->toString(), $truncate->statement->table->schema?->value] // => ['TRUNCATE TABLE shop.t', 'shop']Properties§
public QualifiedName $tableMethods§
public function __construct(public QualifiedName $table)Parameters
$table | QualifiedName | The table with its optional database |
Calls 1
- static-call Check::input() line 43
public function deriveStatement(Derivation $derivation): voidRecords the resolution of the table.
Parameters
$derivation | Derivation |
Calls 6
- method-call Derivation::target() line 51
- method-call Targets::target() line 51
- new Targets line 51
- method-call RelationKinds::refuseView() line 52
- new RelationKinds line 52
- class-const KindRefusal::NoSuchTable() line 52
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 60
- method-call Output::name() line 62
- class-const NameUse::Qualifier() line 62
- class-const NameUse::Relation() line 64
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TruncateTableTestcalls