(parsed-query query & {:as opts})
Main entry point: takes a string query and returns a Statement
object that can be handled by the other functions.
Main entry point: takes a string query and returns a `Statement` object that can be handled by the other functions.
(query->components parsed & {:as opts})
Inputs: [parsed :- [:or m.types/error-result [:fn (fn* [p1__8099#] (instance? Statement p1__8099#))]] & {:as opts} :- [:maybe m.types/options-map]] Return: [:or m.types/error-result m.types/components-result]
Given a parsed query (i.e., a [subclass of] Statement
) return a map with the elements found within it.
(Specifically, it returns their fully-qualified names as strings, where 'fully-qualified' means 'as referred to in the query'; this function doesn't do additional inference work to find out a table's schema.)
Inputs: [parsed :- [:or m.types/error-result [:fn (fn* [p1__8099#] (instance? Statement p1__8099#))]] & {:as opts} :- [:maybe m.types/options-map]] Return: [:or m.types/error-result m.types/components-result] Given a parsed query (i.e., a [subclass of] `Statement`) return a map with the elements found within it. (Specifically, it returns their fully-qualified names as strings, where 'fully-qualified' means 'as referred to in the query'; this function doesn't do additional inference work to find out a table's schema.)
(query->tables sql & {:keys [mode] :as opts})
Inputs: [sql :- :string & {:keys [mode], :as opts} :- [:maybe m.types/options-map]] Return: [:or m.types/error-result m.types/tables-result]
Given a parsed query (i.e., a [subclass of] Statement
) return a set of all the table identifiers found within it.
Inputs: [sql :- :string & {:keys [mode], :as opts} :- [:maybe m.types/options-map]] Return: [:or m.types/error-result m.types/tables-result] Given a parsed query (i.e., a [subclass of] `Statement`) return a set of all the table identifiers found within it.
(replace-names sql renames & {:as opts})
Inputs: [sql :- :string renames :- :map & {:as opts} :- [:maybe m.types/options-map]] Return: :string
Given an SQL query, apply the given table, column, and schema renames.
Supported options:
case-insensitive: whether to relax the comparison
quotes-preserve-case: whether quoted identifiers should override the previous option.
Inputs: [sql :- :string renames :- :map & {:as opts} :- [:maybe m.types/options-map]] Return: :string Given an SQL query, apply the given table, column, and schema renames. Supported options: - case-insensitive: whether to relax the comparison - :upper - identifiers are implicitly case to uppercase, as per the SQL-92 standard. - :lower - identifiers are implicitly cast to lowercase, as per Postgres et al. - :agnostic - case is ignored when comparing identifiers in code to replacement "from" strings. - quotes-preserve-case: whether quoted identifiers should override the previous option.
(scope-id s)
A unique identifier for the given scope.
A unique identifier for the given scope.
(scope-label s)
The type of scope we're talking about e.g., a top-level SELECT.
The type of scope we're talking about e.g., a top-level SELECT.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close