classValueKinds
final class ValueKinds
Derives the set of storage classes SQLite expects a result expression of a compound arm to produce.
Rule: SQLITE-DATA-TYPE-001. When the affinity of a column of a compound query is decided, SQLite asks every other arm which kinds of value its expression can produce, as a set of three bits: numeric (1), text (2) and BLOB (4). A NULL produces nothing; a string literal, a concatenation and a double-quoted word that is no column produce text; a BLOB literal produces a BLOB; a bound parameter and a function call produce anything; a column, a subquery, a CAST and a row value produce numbers and BLOBs (numeric affinity), text and BLOBs (TEXT affinity), or anything (no affinity or BLOB affinity); a CASE produces what its results produce; and every other expression produces numbers. Parentheses, COLLATE and a unary plus are looked through. The set is not determined when an affinity it depends on is not. Terminates: each step enters a strict sub-expression. Source: https://sqlite.org/datatype3.html#affinity_of_expressions (and sqlite3ExprDataType() in expr.c of the release). Status: Implemented.
Constants§
public const NUMBER = 0x1The bit of a value that is an integer or a real number.
public const TEXT = 0x2The bit of a value that is text.
public const BLOB = 0x4The bit of a value that is a BLOB.
public const FIXED = [\SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\NullLiteral::class …The kinds of value the expressions whose class alone decides them produce.
Methods§
Answers the kinds of value an expression can produce, or null when they are not determined.
Returns
?intCalled from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::results() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:122
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::arm() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:153
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::arm() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:160
Calls 11
- class-const UnaryOperator::Plus() line 88
- class-const ValueKinds::FIXED() line 91
- class-const BinaryOperator::Concat() line 94
- class-const ValueKinds::TEXT() line 95
- method-call ValueKinds::results() line 98
- method-call Facts::covers() line 100
- method-call Facts::scalar() line 100
- method-call ValueKinds::affined() line 105
- method-call ExpressionAffinity::of() line 105
- new ExpressionAffinity line 105
- class-const ValueKinds::NUMBER() line 108
public function results(CaseExpression $expression, Facts $facts): ?intAnswers the kinds of value a CASE can produce: the union over its results.
Parameters
$expression | CaseExpression | |
$facts | Facts |
Returns
?intTest cases 1
Called from 1
Calls 2
- function-call
array_mapline 117 - method-call ValueKinds::of() line 122
public function affined(DerivedAffinity $affinity): ?intAnswers the kinds of value an operand with an affinity can produce.
Parameters
$affinity | DerivedAffinity |
Returns
?intTest cases 1
Called from 2
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::of() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:105
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::arm() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:163
Calls 5
- method-call DerivedAffinity::numeric() line 140
- class-const ValueKinds::NUMBER() line 141
- class-const ValueKinds::BLOB() line 141
- class-const Affinity::Text() line 144
- class-const ValueKinds::TEXT() line 144
Answers the kinds of value the result of an arm at a position can produce; an expanded star is a column reference.
Returns
?intTest cases 2
Called from 2
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:267
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:278
Calls 6
- method-call ValueKinds::of() line 153
- method-call Facts::covers() line 155
- method-call Facts::query() line 155
- method-call ValueKinds::affined() line 163
- method-call ExpressionAffinity::resolved() line 163
- new ExpressionAffinity line 163
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:267
- new SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:278
Method calls 2
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:267
- method-call SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::column() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:278
Constant reads 2
- class-const SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::adjusted() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:293
- class-const SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::adjusted() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:296