classStorages
final class Storages
Computes with the sets of storage classes a value can have.
Rule: SQLITE-STORAGE-SET-001. A value has one of the storage classes INTEGER, REAL, TEXT and BLOB, or is NULL. A column of an ordinary table can hold the classes its affinity does not convert away: every class under INTEGER, NUMERIC and BLOB affinity; TEXT and BLOB under TEXT affinity; REAL, TEXT and BLOB under REAL affinity. A column of a STRICT table holds only the class of its type, and any class when its type is ANY. A type that depends on a missing input or is invalid has no known set. Source: https://sqlite.org/datatype3.html#type_affinity, https://sqlite.org/stricttables.html. Status: Implemented.
Methods§
Answers the storage classes a type fact admits, or null when the fact fixes no set.
Parameters
$type | TypeFact |
Returns
list<Storage>|nullTest cases 2
Called from 2
Calls 2
- method-call Storages::merge() line 47
- method-call Storages::held() line 47
public function held(object $descriptor): list<Storage>Answers the storage classes a value of a described type can have.
Parameters
$descriptor | object |
Returns
list<Storage>Test cases 3
Called from 2
Calls 10
- static-call Storage::cases() line 70
- class-const Affinity::Integer() line 75
- class-const Storage::Integer() line 75
- class-const Affinity::Real() line 76
- class-const Storage::Real() line 76
- class-const Affinity::Text() line 77
- class-const Storage::Text() line 77
- class-const Affinity::Blob() line 78
- class-const Storage::Blob() line 78
- class-const Affinity::Numeric() line 79
Answers the union of two sets in the fixed order of the storage classes.
Returns
list<Storage>Test cases 1
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Storages::of() packages/sql-semantics-sqlite/src/Rules/Typing/Storages.php:47
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Storages::fact() packages/sql-semantics-sqlite/src/Rules/Typing/Storages.php:116
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Storages::either() packages/sql-semantics-sqlite/src/Rules/Typing/Storages.php:143
Calls 2
- static-call Storage::cases() line 100
- function-call
in_arrayline 101
Answers the type fact of a set of storage classes: NULL only, one known class, or a choice.
Parameters
$storages | list<Storage> |
Returns
Test cases 1
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:209
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Storages::either() packages/sql-semantics-sqlite/src/Rules/Typing/Storages.php:147
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Cast::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Cast.php:65
Answers the type of a value that is one of several values: the union of their classes.
An invalid alternative makes the result invalid; an alternative that depends on missing inputs makes the result depend on them.
Parameters
$alternatives | list<TypeFact> |
Returns
Test cases 3
Called from 5
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::combined() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:121
- method-call SqlSemantics\Platform\Sqlite\Rules\Resolution\Joining::coalesced() packages/sql-semantics-sqlite/src/Rules/Resolution/Joining.php:98
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:209
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\CaseExpression::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/CaseExpression.php:79
- method-call SqlSemantics\Platform\Sqlite\Statement\Query\ValuesClause::deriveQuery() packages/sql-semantics-sqlite/src/Statement/Query/ValuesClause.php:90
Calls 5
- function-call
array_pushline 141 - method-call Storages::merge() line 143
- method-call Storages::of() line 143
- method-call Storages::fact() line 147
- new Dependent line 147
Answers the type of an arithmetic result: REAL when an operand is certainly REAL, NULL when an operand is certainly NULL, else INTEGER or REAL.
Parameters
$operands | list<TypeFact> |
Returns
Test cases 2
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:55
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:60
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::unary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:75
Calls 6
- method-call Storages::of() line 159
- new NullOnly line 161
- class-const Storage::Real() line 163
- new Known line 166
- new Choice line 166
- class-const Storage::Integer() line 166
Answers the type of an operator that yields one class unless an operand is certainly NULL.
Returns
Called from 6
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:49
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:61
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:62
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::unary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:76
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\Between::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/Between.php:67
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\PatternMatch::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/PatternMatch.php:93
Test cases 13§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 13
StoragesTest::testEitherDependsOnTheMissingInputsOfEveryDependentAlternativecallsStoragesTest::testEitherIsInvalidWhenAnAlternativeIscallsStoragesTest::testEitherUnitesTheClassesOfTheAlternativescallsStoragesTest::testFactIsNullOnlyOneKnownClassOrAChoicecallsStoragesTest::testHeldOfAColumnFollowsItsAffinitycallsStoragesTest::testHeldOfAStorageOrAnotherDescriptorIsThatClassOrEveryClasscallsStoragesTest::testHeldOfAStrictColumnIsTheClassOfItsTypecallsStoragesTest::testMergeUnitesInTheFixedOrderOfTheClassescallsStoragesTest::testNumericIsRealWhenAnOperandIsCertainlyRealAndNullWhenOneIsCertainlyNullcallsStoragesTest::testNumericTreatsAColumnAsRealOnlyWhenItCanHoldNothingElsecallsStoragesTest::testOfAnswersTheClassesOfEachKindOfFactcallsStoragesTest::testOfIsNullForADependentOrInvalidFactcallsStoragesTest::testStrictYieldsTheResultClassUnlessAnOperandIsCertainlyNullcalls
Relations§
Instantiated in 10
- new SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::combined() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:121
- new SqlSemantics\Platform\Sqlite\Rules\Resolution\Joining::coalesced() packages/sql-semantics-sqlite/src/Rules/Resolution/Joining.php:98
- new SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:209
- new SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:43
- new SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::unary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:71
- new SqlSemantics\Platform\Sqlite\Statement\Expression\CaseExpression::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/CaseExpression.php:79
- new SqlSemantics\Platform\Sqlite\Statement\Expression\Cast::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Cast.php:65
- new SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\Between::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/Between.php:67
- new SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\PatternMatch::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/PatternMatch.php:93
- new SqlSemantics\Platform\Sqlite\Statement\Query\ValuesClause::deriveQuery() packages/sql-semantics-sqlite/src/Statement/Query/ValuesClause.php:90
Method calls 16
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::combined() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:121
- method-call SqlSemantics\Platform\Sqlite\Rules\Resolution\Joining::coalesced() packages/sql-semantics-sqlite/src/Rules/Resolution/Joining.php:98
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:209
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:209
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:49
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:55
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:60
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:61
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::binary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:62
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::unary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:75
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Operators::unary() packages/sql-semantics-sqlite/src/Rules/Typing/Operators.php:76
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\CaseExpression::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/CaseExpression.php:79
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Cast::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Cast.php:65
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\Between::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/Between.php:67
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\PatternMatch::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Operator/PatternMatch.php:93
- method-call SqlSemantics\Platform\Sqlite\Statement\Query\ValuesClause::deriveQuery() packages/sql-semantics-sqlite/src/Statement/Query/ValuesClause.php:90