classKeyTermRule
final class KeyTermRule
Lowers the string literals that SQLite reads as column names in key constraints and index terms.
Rule: SQLITE-KEY-TERM-LOWER-001. Scope: the sortlist of PRIMARY KEY and UNIQUE table constraints and of CREATE INDEX, after the ordering rule lowered it. A term whose expression is a string literal under parentheses and COLLATE clauses (any number for a key constraint, at most one for an index term, SQLITE-KEY-TERM-001) is rebuilt around a LiteralColumn that holds the recorded literal leaf; the parentheses and collations are rebuilt in the same order. Every other term is left as it is. Terminates: the wrappers of a finite expression are peeled once and put back once. Source: https://sqlite.org/lang_createtable.html#the_primary_key, https://sqlite.org/lang_createindex.html (and sqlite3StringToId() in build.c of the release). Status: Implemented.
Methods§
Lowers the terms of a PRIMARY KEY or UNIQUE constraint.
Parameters
$terms | list<SortTerm> |
Returns
list<SortTerm>Called from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:98
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:102
Calls 2
- function-call
array_mapline 42 - method-call KeyTermRule::term() line 42
Lowers the terms of a CREATE INDEX statement.
Parameters
$terms | list<SortTerm> |
Returns
list<SortTerm>Called from 1
Calls 2
- function-call
array_mapline 53 - method-call KeyTermRule::term() line 53
Rebuilds a term around a literal column when its expression is a string under the admitted wrappers.
Parameters
$term | SortTerm | |
$collations | int|null | How many COLLATE clauses may lie above the string; null for any number |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\KeyTermRule::keyTerms() packages/sql-semantics-sqlite/src/Lowering/Definition/KeyTermRule.php:42
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\KeyTermRule::indexTerms() packages/sql-semantics-sqlite/src/Lowering/Definition/KeyTermRule.php:53
Calls 4
- method-call KeyTerms::string() line 63
- new KeyTerms line 63
- new SortTerm line 67
- method-call KeyTermRule::expression() line 67
Rebuilds the parentheses and collations of an expression around a literal column in place of its string.
Parameters
$expression | Scalar |
Returns
Called from 1
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 3
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\SchemaRule::index() packages/sql-semantics-sqlite/src/Lowering/Definition/SchemaRule.php:122
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:98
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:102
Method calls 3
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\SchemaRule::index() packages/sql-semantics-sqlite/src/Lowering/Definition/SchemaRule.php:122
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:98
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:102