classNameOperand
final class NameOperand
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.An identifier written as an operand of ATTACH or DETACH, which SQLite reads as a text value.
Rule: SQLITE-ATTACH-NAME-001. The operands of ATTACH and DETACH are expressions, but an operand that is a single identifier, with or without parentheses around it, is not a column reference: SQLite turns it into the string of its name before resolving names, which is what makes ATTACH 'file.db' AS aux work. Facts: TEXT, never NULL, no resolution. Source: https://sqlite.org/lang_attach.html (and resolveAttachExpr() in attach.c of the release). Status: Implemented.
$attach = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("ATTACH 'file.db' AS aux");
[$attach->statement->schema->name->value, $attach->facts->scalar($attach->statement->schema)->type->descriptor] // => ['aux', \SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Text]Properties§
public Name $nameMethods§
public function __construct(public Name $name)Parameters
$name | Name | The identifier whose name is the text value |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the facts of a text constant.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- new ScalarFact line 51
- new Known line 51
- class-const Storage::Text() line 51
- class-const Nullability::NotNull() line 51
public function render(Output $out): voidWrites the identifier.
Parameters
$out | Output |
Calls 2
- method-call Output::name() line 59
- class-const NameUse::Label() line 59
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 5
ConnectionRuleTest::testKeyIsNullUnlessAKeyIsWrittencallsConnectionRuleTest::testKeywordIsOptionalBeforeTheOperandcallsConnectionRuleTest::testOperandReadsAnIdentifierInsideParenthesesAsItsNamecallsAttachTest::testRenderDropsTheOptionalKeywordAndKeepsTheKeycallsDetachTest::testRenderDropsTheOptionalKeywordcalls