classUserComment
final class UserComment
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The ATTRIBUTE '…' or COMMENT '…' clause of CREATE USER or ALTER USER.
An attribute must be a JSON object; the server rejects anything else (ER_INVALID_USER_ATTRIBUTE_JSON), which the statement reports. Source: https://dev.mysql.com/doc/refman/8.4/en/create-user.html#create-user-comments-attributes.
$comment = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("CREATE USER u COMMENT 'ops'")->statement->comment;
[$comment?->kind, $comment?->text->value] // => [\SqlSemantics\Platform\MySql\Statement\Account\Option\CommentKind::Comment, 'ops']Properties§
public CommentKind $kindpublic Text $textMethods§
public function __construct(public CommentKind $kind, public Text $text)Parameters
$kind | CommentKind | Whether the attributes or the comment are set |
$text | Text | The JSON object or the comment |
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
UserCommentTestcalls
Relations§
Instantiated in 2
Type declarations 4
- type SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:295
- type SqlSemantics\Platform\MySql\Rules\Account\AccountChecks packages/sql-semantics-mysql/src/Rules/Account/AccountChecks.php:77
- type SqlSemantics\Platform\MySql\Statement\Account\AlterUser packages/sql-semantics-mysql/src/Statement/Account/AlterUser.php:75
- type SqlSemantics\Platform\MySql\Statement\Account\CreateUser packages/sql-semantics-mysql/src/Statement/Account/CreateUser.php:75