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.

Resolving the emptied tabledoctest
$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 $table

Methods§

public function __construct(public QualifiedName $table)

Parameters

$tableQualifiedNameThe table with its optional database
Calls 1
public function deriveStatement(Derivation $derivation): void

Records the resolution of the table.

Parameters

$derivationDerivation
Calls 6
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 4

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 1
Type declarations 1