final class Limits
Restricted visibility: declared "@visibility SqlSemantics\Platform\Sqlite". Code outside that scope must not name this declaration.

Finds the constructs SQLite rejects inside the expressions of a definition.

Rule: SQLITE-DEFINITION-LIMITS-001. SQLite resolves the expressions of a CHECK constraint, a partial index WHERE clause, an index expression and a generated column against the table itself and rejects, at every one of these positions, a bound parameter and a subquery (an IN table operand is a subquery, because SQLite reads it as one); at an index expression and in a generated column also a qualified column reference, "the . operator"; and at an index expression, in a partial index WHERE clause and in a generated column also a call of a function the library does not flag as constant: random, randomblob, last_insert_rowid, changes, total_changes, current_time, current_timestamp, current_date (the keywords included), sqlite_version, sqlite_source_id, sqlite_compileoption_used, sqlite_compileoption_get and load_extension. The date functions given 'now' pass this check and fail when the index or column is used, which is not modeled. Whether a function that is not built in is deterministic is a registration on the connection and not a fact of the model.

A DEFAULT value must be constant in a different sense: it may call any function but may not contain a bound parameter, a subquery, a column reference (a double-quoted word included) or RAISE.

Each kind of construct is reported once per expression. A subquery is found at the expression that holds it and at the query itself; the inside of a subquery is not examined, as SQLite stops at the subquery. Terminates: the expression is walked once with an explicit stack. Source: https://sqlite.org/lang_createtable.html#check_constraints, https://sqlite.org/lang_createtable.html#the_default_clause, https://sqlite.org/partialindex.html, https://sqlite.org/expridx.html, https://sqlite.org/gencol.html (and sqlite3ResolveSelfReference() in resolve.c and sqlite3ExprIsConstantOrFunction() in expr.c of the release). Status: Implemented.

Methods§

public function nodes(Scalar $expression): list<Node>

Answers the nodes of an expression in depth-first order, without the inside of a subquery.

Parameters

$expressionScalar

Returns

list<Node>
Test cases 1
Called from 2
Calls 6
public function rejected(
    Scalar $expression,
    DefinitionPosition $position,
): list<ProhibitedConstruct>

Answers the constructs of an expression that its position rejects, each once, in order of first use.

Parameters

$expressionScalar
$positionDefinitionPosition

Returns

Test cases 1
Called from 1
Calls 4

Private surface 2§

Implementation details, listed for orientation only.

private const NON_DETERMINISTIC = ['random', 'randomblob', 'last_insert_rowid', 'changes', 'total_changes', 'curr…
private const REJECTED = ['CheckConstraint' => [\SqlSemantics\Platform\Sqlite\Statement\Schema\Limit\Pro…

Test cases 5§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5

Relations§

Instantiated in 6
Method calls 7