classMaintenanceRule
final class MaintenanceRule
Lowers the table maintenance statements and their options.
Rule: MYSQL-MAINTENANCE-001. Scope: analyze, check, optimize, repair (5.6, 5.7), analyze_table_stmt, check_table_stmt, optimize_table_stmt, repair_table_stmt (8.0 and later), checksum, opt_checksum_type, opt_mi_check_type, opt_mi_check_types, mi_check_types, mi_check_type, opt_mi_repair_type, opt_mi_repair_types, mi_repair_types, mi_repair_type, opt_histogram, opt_histogram_update_param, opt_histogram_num_buckets, opt_histogram_auto_update. TABLE and TABLES are synonyms and LOCAL is NO_WRITE_TO_BINLOG (LeafNoise). The options are kept in written order. The bucket count is a NUM token, kept as written. Constructs: AnalyzeTable, CheckTable, ChecksumTable, OptimizeTable, RepairTable, MaintainedTable, UpdateHistogram, LoadHistogram, DropHistogram. Terminates: lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/table-maintenance-statements.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a table maintenance statement.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 13
- class-const MaintenanceRule::STATEMENTS() line 104
- static-call ImplementationGap::production() line 104
- method-call Form::node() line 105
- method-call MaintenanceRule::tables() line 107
- new AnalyzeTable line 110
- method-call MaintenanceRule::histogram() line 110
- new CheckTable line 111
- method-call MaintenanceRule::checkOptions() line 111
- new OptimizeTable line 112
- new RepairTable line 113
- method-call MaintenanceRule::repairOptions() line 113
- new ChecksumTable line 114
- method-call MaintenanceRule::checksum() line 114
public function tables(Node $list): list<MaintainedTable>Lowers a table list: a node of table_list.
Parameters
$list | Node |
Returns
list<MaintainedTable>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 1
public function checkOptions(Node $options): list<CheckOption>Lowers the options of a table check: a node of opt_mi_check_type or opt_mi_check_types.
Parameters
$options | Node |
Returns
list<CheckOption>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:111
- method-call SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::checkOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:72
Calls 3
- method-call MaintenanceRule::options() line 143
- class-const MaintenanceRule::CHECKS() line 144
- static-call ImplementationGap::production() line 144
public function repairOptions(Node $options): list<RepairOption>Lowers the options of a table repair: a node of opt_mi_repair_type or opt_mi_repair_types.
Parameters
$options | Node |
Returns
list<RepairOption>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:113
- method-call SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::repairOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:84
Calls 3
- method-call MaintenanceRule::options() line 159
- class-const MaintenanceRule::REPAIRS() line 160
- static-call ImplementationGap::production() line 160
Answers the option productions of an optional option list, in written order.
Parameters
$options | Node |
Returns
list<Form>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::checkOptions() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:143
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::repairOptions() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:159
Calls 8
- method-call Lowering::form() line 174
- function-call
array_key_existsline 175 - class-const MaintenanceRule::LISTS() line 175
- static-call ImplementationGap::production() line 176
- method-call Lists::items() line 183
- new Lists line 183
- function-call
array_keysline 186 - function-call
array_filterline 186
public function checksum(Node $mode): ?ChecksumModeLowers the method of CHECKSUM TABLE: a node of opt_checksum_type.
Parameters
$mode | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 198
- class-const ChecksumMode::Quick() line 202
- class-const ChecksumMode::Extended() line 203
- static-call ImplementationGap::production() line 204
Lowers the histogram request of ANALYZE TABLE: a node of opt_histogram.
Parameters
$histogram | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 215
- method-call MaintenanceRule::update() line 219
- new DropHistogram line 220
- static-call ImplementationGap::production() line 221
public function update(list<Name> $columns, Node $parameters): UpdateHistogram|LoadHistogramLowers UPDATE HISTOGRAM from its columns and its parameters: a node of opt_histogram_update_param.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 7
- method-call Lowering::form() line 233
- new UpdateHistogram line 236
- method-call MaintenanceRule::buckets() line 237
- new LoadHistogram line 238
- method-call MaintenanceRule::optionalBuckets() line 241
- method-call MaintenanceRule::automatic() line 242
- static-call ImplementationGap::production() line 244
Lowers the optional bucket count of MySQL 8.4 and later: a node of opt_histogram_num_buckets.
Parameters
$buckets | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 255
- method-call MaintenanceRule::buckets() line 259
- static-call ImplementationGap::production() line 260
Lowers the NUM token of WITH NUM BUCKETS.
Parameters
$form | Form |
Returns
Called from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::update() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:237
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\MaintenanceRule::optionalBuckets() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/MaintenanceRule.php:259
Calls 1
- method-call Form::token() line 269
public function automatic(Node $update): ?HistogramUpdateLowers MANUAL UPDATE or AUTO UPDATE: a node of opt_histogram_auto_update.
Parameters
$update | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 279
- class-const HistogramUpdate::Manual() line 283
- class-const HistogramUpdate::Automatic() line 284
- static-call ImplementationGap::production() line 285
Private surface 5§
Implementation details, listed for orientation only.
private const CHECKS = ['mi_check_type: QUICK' => \SqlSemantics\Platform\MySql\Statement\Server\CheckO…private const REPAIRS = ['mi_repair_type: QUICK' => \SqlSemantics\Platform\MySql\Statement\Server\Repai…private const LISTS = ['opt_mi_check_type:' => null, 'opt_mi_check_types:' => null, 'opt_mi_repair_ty…private const STATEMENTS = ['analyze: ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list' => ['…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
MaintenanceRuleTestcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::checkOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:72
- new SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::repairOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:84
- new SqlSemantics\Platform\MySql\Lowering\Server\StatementRule::area() packages/sql-semantics-mysql/src/Lowering/Server/StatementRule.php:113
Method calls 3
- method-call SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::checkOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:72
- method-call SqlSemantics\Platform\MySql\Lowering\Server\ServerRules::repairOptions() packages/sql-semantics-mysql/src/Lowering/Server/ServerRules.php:84
- method-call SqlSemantics\Platform\MySql\Lowering\Server\StatementRule::area() packages/sql-semantics-mysql/src/Lowering/Server/StatementRule.php:113