Liking cljdoc? Tell your friends :D

pg.jdbc

The Next.JDBC-friendly wrapper. Mimics most of the next.jdbc functions and macros.

https://github.com/seancorfield/next-jdbc/blob/develop/src/next/jdbc.clj

The Next.JDBC-friendly wrapper. Mimics most of the
`next.jdbc` functions and macros.

https://github.com/seancorfield/next-jdbc/blob/develop/src/next/jdbc.clj
raw docstring

->fn-executeclj

(->fn-execute expr)
source

active-tx?clj

(active-tx? conn)

True if the connection is a transaction at the moment. Even if the transaction is in an error state, the result will be true.

True if the connection is a transaction at the moment.
Even if the transaction is in an error state, the result
will be true.
sourceraw docstring

execute!clj

(execute! source sql-vec)
(execute! source sql-vec opt)

Given a source and an SQL vector like [expr & params], execute a query and return a result.

The expr might be both a string representing a SQL query or an instance of the PreparedStatement class.

Given a source and an SQL vector like [expr & params],
execute a query and return a result.

The `expr` might be both a string representing a SQL query
or an instance of the `PreparedStatement` class.
sourceraw docstring

execute-batch!clj

(execute-batch! conn sql opts)

Performs batch execution on the server side (TBD).

Performs batch execution on the server side (TBD).
sourceraw docstring

execute-one!clj

(execute-one! source sql-vec)
(execute-one! source sql-vec opt)

Like execute! but returns only the first row.

Like `execute!` but returns only the first row.
sourceraw docstring

get-connectionclj

(get-connection source)

Return a connection object from a source which might be a config map, a pool, or a connection. Not recommended to use as there is a chance to leave the connection not closed. Consider pg/on-connection instead.

Return a connection object from a source which might be
a config map, a pool, or a connection. Not recommended
to use as there is a chance to leave the connection not
closed. Consider `pg/on-connection` instead.
sourceraw docstring

on-connectioncljmacro

(on-connection [bind source] & body)
source

opt-defaultsclj

source

prepareclj

(prepare source sql-vec)
(prepare source sql-vec opt)

Prepare and return an instance of the PreparedStatement class.

The sql-vec must be a vector like [sql & params]. The params, although not requred, might be used for type hints, for example:

['select $1 as foo', 42]

Without passing 42, the parser won't know the desired type of $1 and it will be a default one which is text.

Once prepared, the statement might be used continuously with different parameters.

Don't share it with other connections.

Prepare and return an instance of the `PreparedStatement` class.

The `sql-vec` must be a vector like `[sql & params]`. The `params`,
although not requred, might be used for type hints, for example:

```
['select $1 as foo', 42]
```

Without passing 42, the parser won't know the desired type of $1
and it will be a default one which is text.

Once prepared, the statement might be used continuously
with different parameters.

Don't share it with other connections.
sourceraw docstring

remap-tx-optsclj

(remap-tx-opts jdbc-opt)
source

transactclj

(transact source f)
(transact source f opt)

Having a source and a function that accepts a connection, do the following steps:

  • get a connection from the source;
  • start a new transaction in this connection;
  • run the function with the connection;
  • either commit or rollback the transaction depending on whether there was an exception;
  • if there was not, return the result of the function.

The opt params are similar to with-transaction options.

Having a source and a function that accepts a connection,
do the following steps:

- get a connection from the source;
- start a new transaction in this connection;
- run the function with the connection;
- either commit or rollback the transaction depending
  on whether there was an exception;
- if there was not, return the result of the function.

The `opt` params are similar to `with-transaction` options.
sourceraw docstring

with-transactioncljmacro

(with-transaction [bind source opts] & body)

Execute a block of code in a transaction. The connection with the transaction opened is bound to the bind symbol. The source might be a config map, a connection, or a pool. The opts is a map that accepts next.jdbc parameters for transaction, namely:

  • :isolation: one of these keywords:
    • :read-committed
    • :read-uncommitted
    • :repeatable-read
    • :serializable
  • :read-only: true / false;
  • :rollback-only; true / false.

Return the result of the body block.

Execute a block of code in a transaction. The connection
with the transaction opened is bound to the `bind` symbol.
The source might be a config map, a connection, or a pool.
The `opts` is a map that accepts next.jdbc parameters for
transaction, namely:

- `:isolation`: one of these keywords:
  - `:read-committed`
  - `:read-uncommitted`
  - `:repeatable-read`
  - `:serializable`
- `:read-only`: true / false;
- `:rollback-only`; true / false.

Return the result of the body block.
sourceraw docstring

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

× close