Liking cljdoc? Tell your friends :D

datumbazo.core


asclj

(as expr alias & [columns])

Parse expr and return an expr with and AS clause using alias.

Parse `expr` and return an expr with and AS clause using `alias`.
sourceraw docstring

ascclj

(asc expr)

Parse expr and return an ORDER BY expr using ascending order.

Parse `expr` and return an ORDER BY expr using ascending order.
sourceraw docstring

astclj

(ast stmt)

Returns the abstract syntax tree of stmt.

Returns the abstract syntax tree of `stmt`.
sourceraw docstring

auto-commit?clj

(auto-commit? db)

Returns true if the current database connection is in auto commit mode, otherwise false.

Returns true if the current database connection is in auto commit
mode, otherwise false.
sourceraw docstring

belongs-toclj

(belongs-to db batch source target & [opts])
source

cascadeclj

(cascade condition)

Add a CASCADE clause to an SQL statement.

Add a CASCADE clause to an SQL statement.
sourceraw docstring

chain-stateclj

(chain-state body)
source

checkclj

(check expr)

Add a CHECK clause to an SQL statement.

Add a CHECK clause to an SQL statement.
sourceraw docstring

columnclj

(column name type & {:as options})

Add a column to stmt.

Add a column to `stmt`.
sourceraw docstring

columnsclj

(columns table)

Returns the columns of table.

Returns the columns of `table`.
sourceraw docstring

composeclj

(compose stmt & body)

Compose multiple SQL statements.

Compose multiple SQL statements.
sourceraw docstring

concurrentlyclj

(concurrently condition)

Add a CONCURRENTLY clause to a SQL statement.

Add a CONCURRENTLY clause to a SQL statement.
sourceraw docstring

connectclj

(connect db & [opts])

Connect to db using opts.

Connect to `db` using `opts`.
sourceraw docstring

connected?clj

(connected? db)

Returns true if db is connected, otherwise false.

Returns true if `db` is connected, otherwise false.
sourceraw docstring

connectionclj

(connection db)

Return the current connection to db.

Return the current connection to `db`.
sourceraw docstring

continue-identityclj

(continue-identity condition)

Add a CONTINUE IDENTITY clause to an SQL statement.

Add a CONTINUE IDENTITY clause to an SQL statement.
sourceraw docstring

copyclj

(copy db table columns & body)

Build a COPY statement.

Examples:

(copy db :country [] (from :stdin))

(copy db :country [] (from "/usr1/proj/bray/sql/country_data"))

Build a COPY statement.

Examples:

(copy db :country []
  (from :stdin))

(copy db :country []
  (from "/usr1/proj/bray/sql/country_data"))
sourceraw docstring

count-allclj

(count-all db table)

Count all rows in the database table.

Count all rows in the database `table`.
sourceraw docstring

create-materialized-viewclj

(create-materialized-view db view columns & body)

Build a CREATE MATERIALIZED VIEW statement.

Examples:

(sql/create-materialized-view db :pseudo-source [:key :value] (sql/values [["a" 1] ["a" 2] ["a" 3] ["a" 4] ["b" 5] ["c" 6] ["c" 7]]))

Build a CREATE MATERIALIZED VIEW statement.

Examples:

(sql/create-materialized-view db :pseudo-source [:key :value]
  (sql/values [["a" 1] ["a" 2] ["a" 3] ["a" 4] ["b" 5] ["c" 6] ["c" 7]]))
sourceraw docstring

create-schemaclj

(create-schema db schema & body)

Build a CREATE SCHEMA statement.

Build a CREATE SCHEMA statement.
sourceraw docstring

create-tableclj

(create-table db table & body)

Build a CREATE TABLE statement.

Build a CREATE TABLE statement.
sourceraw docstring

create-typeclj

(create-type db type & body)

Build a CREATE TYPE sql statement.

Build a CREATE TYPE sql statement.
sourceraw docstring

dbclj

(db spec & [opts])

Return a new database from spec.

Return a new database from `spec`.
sourceraw docstring

db?clj

(db? x)

Return true if x is a database, otherwise false.

Return true if `x` is a database, otherwise false.
sourceraw docstring

deftablecljmacro

(deftable table-name doc & body)

Define a database table.

Define a database table.
sourceraw docstring

deleteclj

(delete db table & body)

Build a DELETE statement.

Examples:

(delete db :continents)

(delete db :continents (where '(= :id 1)))

Build a DELETE statement.

Examples:

(delete db :continents)

(delete db :continents
  (where '(= :id 1)))
sourceraw docstring

delimiterclj

(delimiter delimiter)

Add a DELIMITER clause to an SQL statement.

Add a DELIMITER clause to an SQL statement.
sourceraw docstring

descclj

(desc expr)

Parse expr and return an ORDER BY expr using descending order.

Parse `expr` and return an ORDER BY expr using descending order.
sourceraw docstring

disconnectclj

(disconnect db & [opts])

Disconnect from db.

Disconnect from `db`.
sourceraw docstring

distinctclj

(distinct exprs & {:keys [on]})

Parse exprs and return a DISTINCT clause.

Parse `exprs` and return a DISTINCT clause.
sourceraw docstring

do-constraintclj

(do-constraint constraint)

Add a DO CONSTRAINT clause to a SQL statement.

Add a DO CONSTRAINT clause to a SQL statement.
sourceraw docstring

do-nothingclj

(do-nothing)

Add a DO NOTHING clause to a SQL statement.

Add a DO NOTHING clause to a SQL statement.
sourceraw docstring

do-updateclj

(do-update expr)

Add a DO UPDATE clause to a SQL statement.

Add a DO UPDATE clause to a SQL statement.
sourceraw docstring

drop-materialized-viewclj

(drop-materialized-view db view & body)

Build a DROP MATERIALIZED VIEW statement.

Examples:

(drop-materialized-view db :order-summary)

Build a DROP MATERIALIZED VIEW statement.

Examples:

(drop-materialized-view db :order-summary)
sourceraw docstring

drop-schemaclj

(drop-schema db schemas & body)

Build a DROP SCHEMA statement.

Examples:

(drop-schema db [:my-schema])

Build a DROP SCHEMA statement.

Examples:

(drop-schema db [:my-schema])
sourceraw docstring

drop-tableclj

(drop-table db tables & body)

Build a DROP TABLE statement.

Examples:

(drop-table db [:continents])

(drop-table db [:continents :countries])

Build a DROP TABLE statement.

Examples:

(drop-table db [:continents])

(drop-table db [:continents :countries])
sourceraw docstring

drop-typeclj

(drop-type db types & body)

Build a DROP TYPE statement.

Examples:

(drop-type db [:mood])

(drop-table db [:my-schema.mood])

Build a DROP TYPE statement.

Examples:

(drop-type db [:mood])

(drop-table db [:my-schema.mood])
sourceraw docstring

drop-viewclj

(drop-view db view & body)

Build a DROP VIEW statement.

Examples:

(drop-view db :order-summary)

Build a DROP VIEW statement.

Examples:

(drop-view db :order-summary)
sourceraw docstring

encodingclj

(encoding encoding)

Add a ENCODING clause to an SQL statement.

Add a ENCODING clause to an SQL statement.
sourceraw docstring

enumclj

(enum labels)

Returns the enum ast.

Returns the enum ast.
sourceraw docstring

exceptclj

(except & args)

Build an EXCEPT statement.

Examples:

(except (select db [1]) (select db [2]))

(except {:all true} (select db [1]) (select db [2]))

Build an EXCEPT statement.

Examples:

(except
 (select db [1])
 (select db [2]))

(except
 {:all true}
 (select db [1])
 (select db [2]))
sourceraw docstring

excluded-keywordclj

(excluded-keyword k)

Returns the keyword k, prefixed with "EXCLUDED.".

Returns the keyword `k`, prefixed with "EXCLUDED.".
sourceraw docstring

excluded-keyword?clj

(excluded-keyword? k)

Returns true if the keyword k is prefixed with "EXCLUDED.", otherwise false.

Returns true if the keyword `k` is prefixed with "EXCLUDED.",
otherwise false.
sourceraw docstring

excluded-kw-mapclj

(excluded-kw-map ks)

Returns a map of EXCLUDED ks indexed by ks.

Returns a map of EXCLUDED `ks` indexed by `ks`.
sourceraw docstring

executeclj

(execute stmt & [opts])

Execute stmt against a database.

Execute `stmt` against a database.
sourceraw docstring

explainclj

(explain db stmt & [opts])

Return an EXPLAIN statement for stmt. opts can be a map with the following key/value pairs:

  • :analyze boolean
  • :buffers boolean
  • :costs boolean
  • :format :json, :text, :yaml, :xml
  • :timing boolean
  • :verbose boolean

Examples:

(explain db (select db [:*] (from :foo)))

(explain db (select db [:*] (from :foo)) {:analyze true})

Return an EXPLAIN statement for `stmt`. `opts` can be a map with
the following key/value pairs:

 - :analyze boolean
 - :buffers boolean
 - :costs   boolean
 - :format  :json, :text, :yaml, :xml
 - :timing  boolean
 - :verbose boolean

Examples:

(explain db
  (select db [:*]
    (from :foo)))

(explain db
  (select db [:*]
    (from :foo))
  {:analyze true})
sourceraw docstring

fromclj

(from & from)

Add a FROM clause to an SQL statement. The from forms can be one or more tables, :stdin, a filename or an other sub query.

Examples:

(select db [:*] (from :continents))

(select db [:*] (from :continents :countries) (where '(= :continents.id :continent-id)))

(select db [:*] (from (as (select [1 2 3]) :x)))

(copy db :country [] (from :stdin))

(copy db :country [] (from "/usr1/proj/bray/sql/country_data"))

Add a FROM clause to an SQL statement. The `from` forms can be one
or more tables, :stdin, a filename or an other sub query.

Examples:

(select db [:*]
  (from :continents))

(select db [:*]
  (from :continents :countries)
  (where '(= :continents.id :continent-id)))

(select db [:*]
  (from (as (select [1 2 3]) :x)))

(copy db :country []
  (from :stdin))

(copy db :country []
  (from "/usr1/proj/bray/sql/country_data"))
sourceraw docstring

group-byclj

(group-by & exprs)

Add a GROUP BY clause to an SQL statement.

Add a GROUP BY clause to an SQL statement.
sourceraw docstring

has-and-belongs-to-manyclj

(has-and-belongs-to-many db batch source target & [opts])
source

has-manyclj

(has-many db batch source target & [opts])
source

has-oneclj

(has-one db batch source target & [opts])
source

havingclj

(having condition & [combine])

Add a HAVING clause to an SQL statement.

Examples:

(select db [:city '(max :temp-lo)] (from :weather) (group-by :city) (having '(< (max :temp-lo) 40)))

Add a HAVING clause to an SQL statement.

Examples:

(select db [:city '(max :temp-lo)]
  (from :weather)
  (group-by :city)
  (having '(< (max :temp-lo) 40)))
sourceraw docstring

if-existsclj

(if-exists condition)

Add a IF EXISTS clause to an SQL statement.

Add a IF EXISTS clause to an SQL statement.
sourceraw docstring

if-not-existsclj

(if-not-exists condition)

Add a IF EXISTS clause to an SQL statement.

Add a IF EXISTS clause to an SQL statement.
sourceraw docstring

inheritsclj

(inherits & tables)

Add an INHERITS clause to an SQL statement.

Add an INHERITS clause to an SQL statement.
sourceraw docstring

inline-strclj

(inline-str s)

Compile s as an inline string, instead of a prepared statement parameter.

WARNING: You have to make sure the string s is safe against SQL injection attacks yourself.

Compile `s` as an inline string, instead of a prepared statement
parameter.

WARNING: You have to make sure the string `s` is safe against SQL
injection attacks yourself.
sourceraw docstring

insertclj

(insert db table columns & body)

Build a INSERT statement.

Build a INSERT statement.
sourceraw docstring

intersectclj

(intersect & args)

Build an INTERSECT statement.

Examples:

(intersect (select db [1]) (select db [2]))

(intersect {:all true} (select db [1]) (select db [2]))

Build an INTERSECT statement.

Examples:

(intersect
 (select db [1])
 (select db [2]))

(intersect
 {:all true}
 (select db [1])
 (select db [2]))
sourceraw docstring

joinclj

(join from condition & {:keys [type outer pk]})

Add a JOIN clause to a statement.

Examples:

(select db [:*] (from :countries) (join :continents '(using :id)))

(select db [:*] (from :continents) (join :countries.continent-id :continents.id))

(select db [:*] (from :countries) (join :continents '(on (= :continents.id :countries.continent-id))))

Add a JOIN clause to a statement.

Examples:

(select db [:*]
  (from :countries)
  (join :continents '(using :id)))

(select db [:*]
  (from :continents)
  (join :countries.continent-id :continents.id))

(select db [:*]
  (from :countries)
  (join :continents '(on (= :continents.id :countries.continent-id))))
sourceraw docstring

likeclj

(like table & {:as opts})

Add a LIKE clause to an SQL statement.

Add a LIKE clause to an SQL statement.
sourceraw docstring

limitclj

(limit expr)

Add a LIMIT clause to an SQL statement.

Add a LIMIT clause to an SQL statement.
sourceraw docstring

make-instancecljmultimethod

Make a new instance of class using attrs.

Make a new instance of `class` using `attrs`.
sourceraw docstring

make-instancesclj

(make-instances db class records)

Convert all records into instances of class.

Convert all `records` into instances of `class`.
sourceraw docstring

nullsclj

(nulls expr where)

Parse expr and return an NULLS FIRST/LAST expr.

Parse `expr` and return an NULLS FIRST/LAST expr.
sourceraw docstring

offsetclj

(offset expr)

Add a OFFSET clause to an SQL statement.

Add a OFFSET clause to an SQL statement.
sourceraw docstring

on-conflictclj

(on-conflict target & body)

Add a ON CONFLICT clause to a SQL statement.

Add a ON CONFLICT clause to a SQL statement.
sourceraw docstring

on-conflict-on-constraintclj

(on-conflict-on-constraint target & body)

Add a ON CONFLICT ON CONSTRAINT clause to a SQL statement.

Add a ON CONFLICT ON CONSTRAINT clause to a SQL statement.
sourceraw docstring

or-replaceclj

(or-replace condition)

Add an OR REPLACE clause to an SQL statement.

Add an OR REPLACE clause to an SQL statement.
sourceraw docstring

order-byclj

(order-by & exprs)

Add a ORDER BY clause to an SQL statement.

Add a ORDER BY clause to an SQL statement.
sourceraw docstring

page-infoclj

(page-info db target & [params])

Returns the page info for query and params.

Returns the page info for `query` and `params`.
sourceraw docstring

paginateclj

(paginate page & [limit per-page])

Add LIMIT and OFFSET clauses to query calculated from page and per-page.

Add LIMIT and OFFSET clauses to `query` calculated from `page` and
`per-page.`
sourceraw docstring

prepareclj

(prepare db sql & [opts])

Return a prepared statement for sql.

Return a prepared statement for `sql`.
sourceraw docstring

primary-keyclj

(primary-key & keys)

Add a PRIMARY KEY clause to a table.

Add a PRIMARY KEY clause to a table.
sourceraw docstring

(print-explain query)

Print the execution plan of query.

Print the execution plan of `query`.
sourceraw docstring

refresh-materialized-viewclj

(refresh-materialized-view db view & body)

Build a REFRESH MATERIALIZED VIEW statement.

Examples:

(refresh-materialized-view db :order-summary)

Build a REFRESH MATERIALIZED VIEW statement.

Examples:

(refresh-materialized-view db :order-summary)
sourceraw docstring

restart-identityclj

(restart-identity condition)

Add a RESTART IDENTITY clause to an SQL statement.

Add a RESTART IDENTITY clause to an SQL statement.
sourceraw docstring

restrictclj

(restrict condition)

Add a RESTRICT clause to an SQL statement.

Add a RESTRICT clause to an SQL statement.
sourceraw docstring

returningclj

(returning & exprs)

Add a RETURNING clause to an SQL statement.

Examples:

(insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]) (returning :*))

(update db :films {:kind "Dramatic"} (where '(= :kind "Drama")) (returning :*))

Add a RETURNING clause to an SQL statement.

Examples:

(insert db :distributors []
  (values [{:did 106 :dname "XYZ Widgets"}])
  (returning :*))

(update db :films
  {:kind "Dramatic"}
  (where '(= :kind "Drama"))
  (returning :*))
sourceraw docstring

rollback!clj

(rollback! db & [savepoint])
source

runclj

source

selectclj

(select db exprs & body)

Build a SELECT statement.

Examples:

(select db [1])

(select db [:*] (from :continents))

(select db [:id :name] (from :continents))

Build a SELECT statement.

Examples:

(select db [1])

(select db [:*]
  (from :continents))

(select db [:id :name]
  (from :continents))
sourceraw docstring

set-auto-commit!clj

(set-auto-commit! db auto-commit)
source

set-savepoint!clj

(set-savepoint! db & [name])

Set a savepoint on the current connection.

Set a savepoint on the current connection.
sourceraw docstring

sqlclj

(sql stmt)

Compile stmt into a clojure.java.jdbc compatible vector.

Compile `stmt` into a clojure.java.jdbc compatible vector.
sourceraw docstring

sql-strclj

(sql-str stmt)

Prepare stmt using the database and return the raw SQL as a string.

Prepare `stmt` using the database and return the raw SQL as a string.
sourceraw docstring

tableclj

(table name & body)

Make a new table.

Make a new table.
sourceraw docstring

temporaryclj

(temporary condition)

Add a TEMPORARY clause to an SQL statement.

Add a TEMPORARY clause to an SQL statement.
sourceraw docstring

transactclj

(transact db f & [opts])

Run f within a database transaction on db.

Run `f` within a database transaction on `db`.
sourceraw docstring

truncateclj

(truncate db tables & body)

Build a TRUNCATE statement.

Examples:

(truncate db [:continents])

(truncate db [:continents :countries])

Build a TRUNCATE statement.

Examples:

(truncate db [:continents])

(truncate db [:continents :countries])
sourceraw docstring

unionclj

(union & args)

Build a UNION statement.

Examples:

(union (select db [1]) (select db [2]))

(union {:all true} (select db [1]) (select db [2]))

Build a UNION statement.

Examples:

(union
 (select db [1])
 (select db [2]))

(union
 {:all true}
 (select db [1])
 (select db [2]))
sourceraw docstring

updateclj

(update db table row & body)

Build a UPDATE statement.

Examples:

(update db :films {:kind "Dramatic"} (where '(= :kind "Drama")))

Build a UPDATE statement.

Examples:

(update db :films {:kind "Dramatic"}
  (where '(= :kind "Drama")))
sourceraw docstring

valuesclj

(values vals)
(values db vals)

Return a VALUES statement or clause.

Examples:

(values db [[1 "one"] [2 "two"] [3 "three"]])

(insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]))

Return a VALUES statement or clause.

Examples:

(values db [[1 "one"] [2 "two"] [3 "three"]])

(insert db :distributors []
  (values [{:did 106 :dname "XYZ Widgets"}]))
sourceraw docstring

whereclj

(where condition & [combine])

Add a WHERE clause to an SQL statement.

Examples:

(select db [1] (where '(in 1 (1 2 3))))

(select db [*] (from :continents) (where '(= :name "Europe")))

(delete db :continents (where '(= :id 1)))

Add a WHERE clause to an SQL statement.

Examples:

(select db [1]
  (where '(in 1 (1 2 3))))

(select db [*]
  (from :continents)
  (where '(= :name "Europe")))

(delete db :continents
  (where '(= :id 1)))
sourceraw docstring

windowclj

(window & exprs)

Add a WINDOW clause to an SQL statement.

Add a WINDOW clause to an SQL statement.
sourceraw docstring

withclj

(with db bindings query)

Build a WITH (common table expressions) query.

Build a WITH (common table expressions) query.
sourceraw docstring

with-connectioncljmacro

(with-connection [db-sym db & [opts]] & body)

Open a database connection, bind the connected db to db-sym, evaluate body and close the connection again.

Open a database connection, bind the connected `db` to `db-sym`,
evaluate `body` and close the connection again.
sourceraw docstring

with-dataclj

(with-data data?)

Add a WITH [NO] DATA clause to a SQL statement.

Add a WITH [NO] DATA clause to a SQL statement.
sourceraw docstring

with-dbcljmacro

(with-db [db-sym config & [opts]] & body)

Start a database component using config bind it to db-sym, evaluate body and close the database connection again.

Start a database component using `config` bind it to `db-sym`,
evaluate `body` and close the database connection again.
sourceraw docstring

with-rollbackcljmacro

(with-rollback [db-sym db] & body)

Start a transaction, evaluate body and rollback.

Start a transaction, evaluate `body` and rollback.
sourceraw docstring

with-savepointcljmacro

(with-savepoint [db-sym db opts] & body)

Start a transaction, evaluate body and rollback.

Start a transaction, evaluate `body` and rollback.
sourceraw docstring

with-transactioncljmacro

(with-transaction [db-sym db & [opts]] & body)

Start a new db transaction, bind db to db-sym and evaluate body within the transaction.

Start a new `db` transaction, bind `db` to `db-sym` and evaluate
`body` within the transaction.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close