Liking cljdoc? Tell your friends :D

ebifriedrice.rsqlite.sqldeps

Derive a query's dependency profile from a parse tree.

The profile is what the matcher compares update events against:

{:tables          #{table-name}
 :table-columns   {table-name #{column-name}} ; alias-bound
 :columns         #{column-name}              ; scope-unbound
 :wildcard-tables #{table-name}}              ; any change re-runs

Extraction is scoped, walking one Select level at a time with the CTE names visible at that level, so CTE shadowing a real table name in a sibling scope cannot subtract that real table. Columns bind to their table when the reference is alias/table-qualified (u.age, users.age) or when the scope reads a single table; bare references in multi-table scopes stay unbound and match any queried table - over-triggering on shared names there only, never missing. Stars resolve through each core's FROM aliases, including CTE names (to the CTE body's tables, recursively) and FROM subqueries. Anything the grammar cannot parse returns nil here; deps blends with EQP and degrades to table granularity.

All names are normalised - quotes stripped, ASCII-folded - because SQLite treats identifiers as ASCII case-insensitive and the database reports column names in their declared case.

Derive a query's dependency profile from a parse tree.

The profile is what the matcher compares update events against:

    {:tables          #{table-name}
     :table-columns   {table-name #{column-name}} ; alias-bound
     :columns         #{column-name}              ; scope-unbound
     :wildcard-tables #{table-name}}              ; any change re-runs

Extraction is scoped, walking one Select level at a time with the
CTE names visible at that level, so CTE shadowing a real table
name in a sibling scope cannot subtract that real table. Columns
bind to their table when the reference is alias/table-qualified
(u.age, users.age) or when the scope reads a single table; bare
references in multi-table scopes stay unbound and match any
queried table - over-triggering on shared names there only,
never missing. Stars resolve through each core's FROM aliases,
including CTE names (to the CTE body's tables, recursively) and
FROM subqueries. Anything the grammar cannot parse returns nil
here; `deps` blends with EQP and degrades to table granularity.

All names are normalised - quotes stripped, ASCII-folded - because
SQLite treats identifiers as ASCII case-insensitive and the
database reports column names in their declared case.
raw docstring

depsclj/s

(deps sql eqp-tables)
(deps sql eqp-tables columns-lookup)

Dependency profile blending sqlite's own plan with the grammar.

eqp-tables is the normalised table set the backend extracted from EXPLAIN QUERY PLAN for this statement - the sound floor that keeps working for statements the grammar cannot parse. Where the grammar succeeds it contributes column granularity and star resolution on top; where it fails, the profile degrades to table granularity (wildcards over every planned table) rather than re-running on every write. :all survives only for the degenerate case of an empty EQP set with an unparsable statement.

columns-lookup, when given (table -> column names), resolves bare references in all-real-tables multi-table scopes against the schema: a name declared by exactly one in-scope table binds there, killing the last shared-name over-trigger; ambiguous or unknown-schema references stay unbound.

Dependency profile blending sqlite's own plan with the grammar.

eqp-tables is the normalised table set the backend extracted from
EXPLAIN QUERY PLAN for this statement - the sound floor that keeps
working for statements the grammar cannot parse. Where the grammar
succeeds it contributes column granularity and star resolution on
top; where it fails, the profile degrades to table granularity
(wildcards over every planned table) rather than re-running on
every write. :all survives only for the degenerate case of an
empty EQP set with an unparsable statement.

columns-lookup, when given (table -> column names), resolves bare
references in all-real-tables multi-table scopes against the
schema: a name declared by exactly one in-scope table binds
there, killing the last shared-name over-trigger; ambiguous or
unknown-schema references stay unbound.
sourceraw docstring

deps-schemaclj/s

source

eqp-detail-tableclj/s

(eqp-detail-table detail)

Table name from one EXPLAIN QUERY PLAN detail string, or nil. Handles both the modern ('SCAN users', 'SEARCH users AS u USING ...') and legacy ('SCAN TABLE users') shapes; skips plan artifacts that are not base tables (subqueries, temp b-trees, co-routines). Shared by every backend, since EQP detail format is sqlite's, not the driver's. JS regexes lack inline flags, hence the per-platform patterns.

Table name from one EXPLAIN QUERY PLAN detail string, or nil.
Handles both the modern ('SCAN users', 'SEARCH users AS u USING
...') and legacy ('SCAN TABLE users') shapes; skips plan artifacts
that are not base tables (subqueries, temp b-trees, co-routines).
Shared by every backend, since EQP detail format is sqlite's, not
the driver's. JS regexes lack inline flags, hence the per-platform
patterns.
sourceraw docstring

norm-nameclj/s

(norm-name s)

Strip identifier quoting and ASCII-lower, the shared normalisation for names from SQL and from the database.

Strip identifier quoting and ASCII-lower, the shared normalisation
for names from SQL and from the database.
sourceraw docstring

pure-depsclj/s

(pure-deps sql)

Grammar-only dependency profile of a SELECT statement - tables, alias-bound columns, star-resolved wildcards, all normalised - or nil when the grammar cannot parse it. Engine code wants deps, which blends this with the EQP-reported table set.

Grammar-only dependency profile of a SELECT statement - tables,
alias-bound columns, star-resolved wildcards, all normalised - or
nil when the grammar cannot parse it. Engine code wants `deps`,
which blends this with the EQP-reported table set.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close