classHandlerOpen
final class HandlerOpen
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.HANDLER ... OPEN: opens a table for direct reads under its name or an alias.
Rule: MYSQL-HANDLER-OPEN-001. The table name resolves like a table reference (MYSQL-TABLE-SHAPES-001) and is recorded as a table use of the statement; a declared view is refused (MYSQL-RELATION-KIND-001). The statement returns no rows. Terminates: no child. Source: https://dev.mysql.com/doc/refman/8.4/en/handler.html. Status: Implemented.
$open = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('HANDLER shop.t OPEN AS h');
[$open->statement->table->name->value, $open->statement->alias?->value, $open->toString()] // => ['t', 'h', 'HANDLER shop.t OPEN AS h']Properties§
public QualifiedName $tablepublic Name|null $alias = nullpublic AliasMark $mark = AliasMark::AsMethods§
public function __construct(
public QualifiedName $table,
public Name|null $alias = null,
public AliasMark $mark = AliasMark::As,
)Parameters
$table | QualifiedName | The table with its optional database |
$alias | Name|null | The name of the handler; the table name when absent |
$mark | AliasMark | What is written before the alias |
Calls 2
- class-const AliasMark::As() line 43
- static-call Check::input() line 45
public function deriveStatement(Derivation $derivation): voidResolves the table and records it as the table use of the statement.
Parameters
$derivation | Derivation |
Calls 7
- method-call Derivation::target() line 54
- method-call TableShapes::named() line 54
- new TableShapes line 54
- method-call Derivation::environment() line 54
- method-call RelationKinds::require() line 55
- new RelationKinds line 55
- class-const RelationKind::BaseTable() line 55
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 6
- method-call Output::keyword() line 63
- method-call Output::name() line 65
- class-const NameUse::Qualifier() line 65
- class-const NameUse::Relation() line 67
- method-call AliasMark::write() line 69
- class-const NameUse::Alias() line 70
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.