classRepairTable
final class RepairTable
implements Statement
uses Snapshot
@visibility public.REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE t, … [QUICK] [EXTENDED] [USE_FRM]: a request to repair possibly corrupted tables.
Mirrors PT_repair_table_stmt (Sql_cmd_repair_table). Rule: MYSQL-REPAIR-TABLE-001. Each table resolves by MYSQL-SERVER-TABLES-001 and its resolution is the relation fact of its MaintainedTable; a table named twice is NonUniqueTable. The options are kept in written order; the server merges them into flags. LOCAL is a synonym of NO_WRITE_TO_BINLOG, which is written. TABLE and TABLES are synonyms; TABLE is written. The server returns one row per table and message; its columns are MYSQL-ADMIN-ROWS-001. Source: https://dev.mysql.com/doc/refman/8.4/en/repair-table.html. Status: Implemented.
$statement = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('repair table t quick use_frm');
[$statement->toString(), $statement->statement->options[1] === \SqlSemantics\Platform\MySql\Statement\Server\RepairOption::UseFrm] // => ['REPAIR TABLE t QUICK USE_FRM', true]Properties§
public list<MaintainedTable> $tablespublic list<RepairOption> $optionspublic bool $noWriteToBinlogMethods§
public function __construct(
public bool $noWriteToBinlog,
list<MaintainedTable> $tables,
list<RepairOption> $options = [],
)Parameters
$noWriteToBinlog | bool | Whether NO_WRITE_TO_BINLOG or its synonym LOCAL is written |
$tables | list<MaintainedTable> | The tables in written order; at least one |
$options | list<RepairOption> | The options in written order |
Throws
InvalidConstruction When the table list is empty or an option list holds a foreign valueCalls 4
- method-call MaintainedTables::checked() line 55
- new MaintainedTables line 55
- static-call Check::listOf() line 56
- class-const RepairOption::class() line 56
public function deriveStatement(Derivation $derivation): voidRecords the resolution of each table, reports a table named twice, and records the result rows.
Parameters
$derivation | Derivation |
Calls 4
- method-call MaintainedTables::derive() line 64
- new MaintainedTables line 64
- method-call AdminRows::admin() line 65
- new AdminRows line 65
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call MaintainedTables::render() line 73
- new MaintainedTables line 73
- method-call Output::keyword() line 75
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RepairTableTestcalls