classAlterEvent
final class AlterEvent
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.ALTER EVENT: changes the schedule, name, status, comment or statement of an event.
Every clause is optional in the grammar; a statement without any clause is still structured (the server rejects it). The statement changes no context. The facts follow MYSQL-EVENT-001. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-event.html.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER EVENT e RENAME TO shop.f ENABLE');
[$alter->statement->newName->name->value, $alter->statement->status, $alter->statement->schedule] // => ['f', \SqlSemantics\Platform\MySql\Statement\Routine\Event\EventStatus::Enable, null]Properties§
public ProgramStatement|Statement|null $bodypublic QualifiedName $namepublic Schedule|null $schedule = nullpublic Completion|null $completion = nullpublic QualifiedName|null $newName = nullpublic EventStatus|null $status = nullpublic Text|null $comment = nullpublic Account|null $definer = nullMethods§
public function __construct(
public QualifiedName $name,
public Schedule|null $schedule = null,
public Completion|null $completion = null,
public QualifiedName|null $newName = null,
public EventStatus|null $status = null,
public Text|null $comment = null,
Node|null $body = null,
public Account|null $definer = null,
)Parameters
$name | QualifiedName | The event name with its optional database |
$schedule | Schedule|null | The new schedule, when written |
$completion | Completion|null | The ON COMPLETION clause, when written |
$newName | QualifiedName|null | The name of RENAME TO, when written |
$status | EventStatus|null | The status clause, when written |
$comment | Text|null | The COMMENT clause, when written |
$body | Node|null | The new statement after DO, when written: a program statement or an SQL statement |
$definer | Account|null | The DEFINER clause, when written |
Throws
InvalidConstruction When the body is of another classCalls 3
- static-call Check::input() line 69
- method-call StatementSequence::member() line 71
- new StatementSequence line 71
public function deriveStatement(Derivation $derivation): voidDerives the schedule and the body, when written.
Parameters
$derivation | Derivation |
Calls 2
- method-call ProgramFacts::event() line 79
- new ProgramFacts line 79
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Test cases 1
Calls 5
- method-call Output::keyword() line 87
- method-call ProgramNames::qualified() line 92
- new ProgramNames line 92
- method-call EventClauses::write() line 96
- new EventClauses line 96
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
AlterEventTest::testABodyOfAnotherClassIsRejectedcallsAlterEventTest::testAHexadecimalCommentIsRejectedcallsAlterEventTest::testANewNameWithACatalogIsRejectedcallsAlterEventTest::testDeriveStatementAcceptsAnAlterationWithoutClausescallsAlterEventTest::testRenderWritesAConstructedAlterationcalls
Other tests reaching this symbol 7
EventRuleTest::testAlterLowersEveryChangecallsEventRuleTest::testAlterLowersTheStructurecallsEventRuleTest::testCommentLowersTheTextcallsEventRuleTest::testCompletionLowersPreserveAndNotPreservecallsEventRuleTest::testStatusLowersEveryStatuscallsStatementRuleTest::testEventLowersTheStatementOfAnEventcallsRoutineRulesTest::testDefinitionRoutesAlterAndDropFormscalls