stch.sql.format documentation

Format query and DML statements. Use with stch.sql.

*clause*

During formatting, *clause* is bound to :select, :from, :where, etc.

*fn-context?*

*input-params*

*param-counter*

*param-names*

*params*

Will be bound to an atom-vector that accumulates SQL parameters across
possibly-recursive function calls

*quote-identifier-fn*

*subquery?*

-to-sql

(-to-sql x)

ToSQL

clause-order

Determines the order that clauses will be placed within generated SQL

expand-binary-ops

(expand-binary-ops op & args)

fn-aliases

fn-handler

format

(format sql-map & params-or-opts)
Takes a SQL map and optional input parameters and returns a vector
of a SQL string and parameters, as expected by clojure.java.jdbc.

Input parameters will be filled into designated spots according to
name (if a map is provided) or by position (if a sequence is provided).

Instead of passing parameters, you can use keyword arguments:
  :params - input parameters
  :quoting - quote style to use for identifiers; one of :ansi (PostgreSQL),
             :mysql, :sqlserver, or :oracle. Defaults to no quoting.
  :return-param-names - when true, returns a vector of
                        [sql-str param-values param-names]

format-clause

Takes a map entry representing a clause and returns an SQL string

format-join

(format-join type table pred)

format-predicate

(format-predicate pred & {:keys [quoting]})
Formats a predicate (e.g., for WHERE, JOIN, or HAVING) as a string.

format-predicate*

(format-predicate* pred)

infix-fns

known-clauses

quote-identifier

(quote-identifier x & {:keys [style split], :or {split true}})

sqlable?

(sqlable? x)

to-sql

(to-sql x)