Liking cljdoc? Tell your friends :D

clojure.java.jdbc

A Clojure interface to SQL databases via JDBC

clojure.java.jdbc provides a simple abstraction for CRUD (create, read, update, delete) operations on a SQL database, along with basic transaction support. Basic DDL operations are also supported (create table, drop table, access to table metadata).

Maps are used to represent records, making it easy to store and retrieve data. Results can be processed using any standard sequence operations.

For most operations, Java's PreparedStatement is used so your SQL and parameters can be represented as simple vectors where the first element is the SQL string, with ? for each parameter, and the remaining elements are the parameter values to be substituted.

For more documentation, see:

http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html

A Clojure interface to SQL databases via JDBC

clojure.java.jdbc provides a simple abstraction for CRUD (create, read,
update, delete) operations on a SQL database, along with basic transaction
support. Basic DDL operations are also supported (create table, drop table,
access to table metadata).

Maps are used to represent records, making it easy to store and retrieve
data. Results can be processed using any standard sequence operations.

For most operations, Java's PreparedStatement is used so your SQL and
parameters can be represented as simple vectors where the first element
is the SQL string, with ? for each parameter, and the remaining elements
are the parameter values to be substituted.

For more documentation, see:

http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
raw docstring

clojure.java.jdbc.datafy

Variants of 'query' functions from clojure.java.jdbc that support the new clojure.datafy functionality in Clojure 1.10.

The whole schema/column lookup piece is very likely to change!

Currently, the :schema option for a 'query' function is a mapping from column name to a tuple of table name, key column, and optionally the cardinality (:one -- the default -- or :many). The cardinality determines whether navigation should produce a single row (hash map) or a result set.

One of the problems is that the general case -- query -- doesn't have any concept of an associated table name (and may of course join across multiple tables), so there's no good way to take the table name into account when mapping a column to another table.

For find-by-keys and get-by-id, you do have the starting table name so you could map [table1 column1] to [table2 column2] and have table-specific mappings.

The obvious, logical thing would be to use SQL metadata to figure out actual foreign key constraints but not everyone uses them, for a variety of reasons. For folks who do use them, they can build their schema structure from the database, and pass the relevant part of it to the functions below (via :schema in options).

Variants of 'query' functions from clojure.java.jdbc that support
the new clojure.datafy functionality in Clojure 1.10.

The whole schema/column lookup piece is very likely to change!

Currently, the :schema option for a 'query' function is a mapping
from column name to a tuple of table name, key column, and optionally
the cardinality (:one -- the default -- or :many). The cardinality
determines whether navigation should produce a single row (hash map)
or a result set.

One of the problems is that the general case -- query -- doesn't
have any concept of an associated table name (and may of course
join across multiple tables), so there's no good way to take the
table name into account when mapping a column to another table.

For find-by-keys and get-by-id, you do have the starting table
name so you could map [table1 column1] to [table2 column2] and have
table-specific mappings.

The obvious, logical thing would be to use SQL metadata to figure
out actual foreign key constraints but not everyone uses them, for
a variety of reasons. For folks who do use them, they can build
their schema structure from the database, and pass the relevant
part of it to the functions below (via :schema in options).
raw docstring

clojure.java.jdbc.spec

Optional specifications for use with Clojure 1.9 or later.

Optional specifications for use with Clojure 1.9 or later.
raw docstring

No vars found in this namespace.

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

× close