classChangeReplicationSource
final class ChangeReplicationSource
implements Statement
uses Snapshot
@visibility public.CHANGE REPLICATION SOURCE TO option = value, … [FOR CHANNEL 'name'], written CHANGE MASTER TO in the legacy vocabulary.
Mirrors SQLCOM_CHANGE_REPLICATION_SOURCE with its LEX_SOURCE_INFO: the options in written order, the same option possibly written more than once (the server keeps the last value). The vocabulary is the one of the release (MYSQL-REPLICATION-RELEASE-001); in 8.0 to 8.3 CHANGE MASTER and the MASTER_ options are read as their current synonyms. A channel needs MySQL 5.7 or later. Rule: MYSQL-CHANGE-SOURCE-001. Facts: the option checks of MYSQL-REPLICATION-SOURCE-001 and a line feed in the channel name. The statement uses no table and provides no declaration. Source: https://dev.mysql.com/doc/refman/8.4/en/change-replication-source-to.html, https://dev.mysql.com/doc/refman/5.7/en/change-master-to.html. Status: Implemented.
$change = (new \SqlSemantics\Platform\MySql\Semantics('mysql-8.0.44'))->analyze("CHANGE MASTER TO MASTER_HOST = 'h', MASTER_PORT = 3307 FOR CHANNEL 'c'");
[$change->toString(), $change->statement->options[1]->kind] // => ["CHANGE REPLICATION SOURCE TO SOURCE_HOST = 'h', SOURCE_PORT = 3307 FOR CHANNEL 'c'", \SqlSemantics\Platform\MySql\Statement\Replication\Source\SourceOptionKind::Port]Properties§
public list<SourceOption> $optionspublic Terminology $terminologypublic Text|null $channel = nullMethods§
public function __construct(
public Terminology $terminology,
list<SourceOption> $options,
public Text|null $channel = null,
)Parameters
$terminology | Terminology | The vocabulary the statement is written in |
$options | list<SourceOption> | The options in written order; at least one, each in the vocabulary of the statement |
$channel | Text|null | The replication channel, when FOR CHANNEL is written |
Calls 3
- static-call Check::listOf() line 54
- class-const SourceOption::class() line 54
- static-call Check::input() line 56
public function deriveStatement(Derivation $derivation): voidChecks the vocabulary of the release and derives the options and the channel.
Parameters
$derivation | Derivation |
Calls 7
- new Releases line 65
- static-call Check::input() line 67
- method-call Releases::source() line 67
- class-const GrammarRelease::MySql5651() line 68
- new SourceSettings line 69
- method-call SourceSettings::options() line 70
- method-call SourceSettings::lineFeed() line 71
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 79
- class-const Terminology::Legacy() line 80
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.