classTextLiteral
final class TextLiteral
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A string literal, kept as its decoded text.
Rule: SQLITE-TEXT-LITERAL-001. A string constant in single quotes has storage class TEXT; a quote inside it is written twice. Source: https://sqlite.org/lang_expr.html#literal_values_constants_. Status: Implemented.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("SELECT 'it''s'");
[$query->statement->columns[0]->expression->value, $query->toString()] // => ["it's", "SELECT 'it''s'"]Properties§
public string $valueMethods§
public function __construct(public string $value)Parameters
$value | string | The decoded text |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives TEXT.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- new ScalarFact line 46
- new Known line 46
- class-const Storage::Text() line 46
- class-const Nullability::NotNull() line 46
public function render(Output $out): voidWrites the text in single quotes with each quote doubled.
Parameters
$out | Output |
Calls 2
- method-call Output::spelled() line 54
- function-call
str_replaceline 54
Test cases 37§
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 35
ConnectionRuleTest::testOperandLowersAnyOtherExpressionAsAnExpressioncallsKeyTermRuleTest::testExpressionRebuildsTheWrappersInOrderAroundTheLiteralcallsKeyTermRuleTest::testIndexTermsWrapAStringUnderAtMostOneCollationcallsKeyTermRuleTest::testTermLeavesEveryOtherTermAsItIscallsExpressionRuleTest::testExpressionLowersCollateCastAndRowExpressionscallsExpressionRuleTest::testExpressionLowersRaiseWithAndWithoutAMessagecallsExpressionRuleTest::testItemsLowersTheExpressionsOfARowInWrittenOrdercallsLiteralRuleTest::testTermLowersNullAndADecodedStringcallsEquivalenceTest::testDifferenceNamesAChangedClasscallsKeyTermsTest::testBeneathStopsAtTheCollationLimitcallsKeyTermsTest::testColumnReadsAPlainNameAStringAndADoubleQuotedWordcallsKeyTermsTest::testReferenceAcceptsEveryColumnReferenceAndNoOtherExpressioncallsKeyTermsTest::testStringTellsALiteralUnderTheAdmittedWrapperscallsPrecedenceTest::testEdgesOfAMatchEndWithTheEscapeWhenWrittencallsOrdinalsTest::testValueIsNullForAnOrdinaryExpressioncallsCaseBranchTest::testRenderWritesANewlyBuiltBranchcallsCaseExpressionTest::testDeriveScalarChoosesAmongTheResultTypesAndIsNotNullWithElsecallsPatternMatchTest::testRefusesAMatchedOperandThatEndsInAWeakerOperatorcallsPatternMatchTest::testRefusesAnEscapeAfterAPatternThatWouldTakeItcallsPatternMatchTest::testRefusesAnEscapeOperandThatStartsWithAnEqualityOperatorcallsPatternMatchTest::testRefusesAPatternThatStartsWithAnEqualityOperatorcallsPatternMatchTest::testRenderWritesANewlyBuiltMatchcallsPatternMatchTest::testRenderWritesTheNegationAndTheEscapecallsRaiseTest::testDeriveScalarYieldsNoValueInsideATriggercallsRaiseTest::testRenderWritesANewlyBuiltRaisecallsAssignmentTest::testRenderWritesTheColumnAnEqualsSignAndTheValuecallsRowAssignmentTest::testRenderWritesTheColumnListAndTheValuecallsOutputOrdinalTest::testRenderRefusesAnExpressionThatIsNoIntegerConstantcallsValueRowTest::testRenderWritesANewlyBuiltRowcallsValueRowTest::testRenderWritesTheValuesInParenthesescallsTableCallTest::testRenderWritesSchemaNameArgumentsAndAliascallsCreateIndexTest::testRefusesAStringLiteralTermThatNamesAColumncallsLiteralColumnTest::testNameIsTheValueOfTheLiteralcallsTablePrimaryKeyTest::testRefusesAStringLiteralTermThatNamesAColumncallsTableUniqueTest::testRefusesAStringLiteralTermThatNamesAColumncalls
Relations§
Instantiated in 1
Constant reads 1
Type checks 2
- instanceof SqlSemantics\Platform\Sqlite\Lowering\Definition\KeyTermRule::expression() packages/sql-semantics-sqlite/src/Lowering/Definition/KeyTermRule.php:80
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\KeyTerms::string() packages/sql-semantics-sqlite/src/Rules/Definition/KeyTerms.php:70