packages/sql-semantics-mysql/src/Statement/Replication/Problem/ReplicationError.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\MySql\Statement\Replication\Problem;
6
7/**
8 * The checks the server's parser applies to the values of replication statements.
9 *
10 * Each case names the server error the statement fails with and describes
11 * it. The server raises them while it parses, after the grammar has accepted
12 * the statement.
13 * Source: sql/sql_yacc.yy of MySQL 5.6.51 to 9.1.0 (the actions of
14 * TEXT_STRING_sys_nonewline, source_def, replica_until, start_replica_stmt,
15 * source_reset_options, filter_wild_db_table_string, dec_num_error and
16 * group_replication_password), https://dev.mysql.com/doc/refman/8.4/en/change-replication-source-to.html.
17 *
18 * @visibility public
19 * @example Describing a check
20 *     \SqlSemantics\Platform\MySql\Statement\Replication\Problem\ReplicationError::PasswordTooLong->value // => 'A replication password is longer than 32 characters (ER_CHANGE_SOURCE_PASSWORD_LENGTH).'
21 */
22enum ReplicationError: string
23{
24    case LineFeed = 'The value may not contain a line feed (ER_WRONG_VALUE).';
25    case PasswordTooLong = 'A replication password is longer than 32 characters (ER_CHANGE_SOURCE_PASSWORD_LENGTH).';
26    case GroupPasswordTooLong = 'A group replication password is longer than 32 characters (ER_GROUP_REPLICATION_PASSWORD_LENGTH).';
27    case DelayOutOfRange = 'The replication delay is greater than 2147483647 seconds (ER_SOURCE_DELAY_VALUE_OUT_OF_RANGE).';
28    case HeartbeatOutOfRange = 'The heartbeat period is greater than 4294967 seconds (ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE).';
29    case RowFormatValue = 'REQUIRE_ROW_FORMAT accepts only 0 or 1 (ER_REQUIRE_ROW_FORMAT_INVALID_VALUE).';
30    case SwitchValue = 'SOURCE_CONNECTION_AUTO_FAILOVER and GTID_ONLY accept only 0 or 1 (ER_PARSE_ERROR).';
31    case FractionalNumber = 'Only integers are allowed as the value (ER_ONLY_INTEGERS_ALLOWED).';
32    case InvalidUuid = 'The value is not a UUID (ER_WRONG_VALUE).';
33    case UntilCondition = 'The UNTIL condition names neither a complete position, nor a GTID set, nor only SQL_AFTER_MTS_GAPS (ER_BAD_REPLICA_UNTIL_COND).';
34    case ApplierWithCredentials = 'Connection options need the receiver thread; SQL_THREAD alone is started (ER_SQLTHREAD_WITH_SECURE_REPLICA).';
35    case FileNumberOutOfRange = 'The binary log file number is 0 or greater than 2000000000 (ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE).';
36    case WildPattern = 'A wildcard table filter pattern has no dot between database and table (ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN).';
37}
38