forked from korma/Korma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkorma.db.html
31 lines (29 loc) · 11.5 KB
/
korma.db.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html><head><link href="css/default.css" rel="stylesheet" type="text/css"><script src="js/jquery.min.js" type="text/javascript"></script><script src="js/page_effects.js" type="text/javascript"></script><title>korma.db documentation</title></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html">Korma 0.4.0 API documentation</a></h1></div><div class="sidebar" id="namespaces"><h3><span>Namespaces</span></h3><ul><li><a href="korma.config.html"><span>korma.config</span></a></li><li><a href="korma.core.html"><span>korma.core</span></a></li><li class="current"><a href="korma.db.html"><span>korma.db</span></a></li><li><a href="korma.mysql.html"><span>korma.mysql</span></a></li></ul></div><div class="sidebar" id="vars"><h3>Public Vars</h3><ul><li><a href="korma.db.html#var-connection-pool"><span>connection-pool</span></a></li><li><a href="korma.db.html#var-create-db"><span>create-db</span></a></li><li><a href="korma.db.html#var-default-connection"><span>default-connection</span></a></li><li><a href="korma.db.html#var-defdb"><span>defdb</span></a></li><li><a href="korma.db.html#var-delay-pool"><span>delay-pool</span></a></li><li><a href="korma.db.html#var-firebird"><span>firebird</span></a></li><li><a href="korma.db.html#var-get-connection"><span>get-connection</span></a></li><li><a href="korma.db.html#var-h2"><span>h2</span></a></li><li><a href="korma.db.html#var-is-rollback%3F"><span>is-rollback?</span></a></li><li><a href="korma.db.html#var-msaccess"><span>msaccess</span></a></li><li><a href="korma.db.html#var-mssql"><span>mssql</span></a></li><li><a href="korma.db.html#var-mysql"><span>mysql</span></a></li><li><a href="korma.db.html#var-odbc"><span>odbc</span></a></li><li><a href="korma.db.html#var-oracle"><span>oracle</span></a></li><li><a href="korma.db.html#var-postgres"><span>postgres</span></a></li><li><a href="korma.db.html#var-rollback"><span>rollback</span></a></li><li><a href="korma.db.html#var-sqlite3"><span>sqlite3</span></a></li><li><a href="korma.db.html#var-transaction"><span>transaction</span></a></li><li><a href="korma.db.html#var-vertica"><span>vertica</span></a></li><li><a href="korma.db.html#var-with-db"><span>with-db</span></a></li></ul></div><div class="namespace-docs" id="content"><h2>korma.db documentation</h2><pre class="doc">Functions for creating and managing database specifications.
</pre><div class="public" id="var-connection-pool"><h3>connection-pool</h3><div class="usage"><code>(connection-pool {:keys [subprotocol subname classname user password excess-timeout idle-timeout minimum-pool-size maximum-pool-size test-connection-query idle-connection-test-period test-connection-on-checkin test-connection-on-checkout], :or {excess-timeout (* 30 60), idle-timeout (* 3 60 60), minimum-pool-size 3, maximum-pool-size 15, test-connection-query nil, idle-connection-test-period 0, test-connection-on-checkin false, test-connection-on-checkout false}, :as spec})</code></div><pre class="doc">Create a connection pool for the given database spec.
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L19">Source</a></div></div><div class="public" id="var-create-db"><h3>create-db</h3><div class="usage"><code>(create-db spec)</code></div><pre class="doc">Create a db connection object manually instead of using defdb. This is often
useful for creating connections dynamically, and probably should be followed
up with:
(default-connection my-new-conn)
If the spec includes `:make-pool? true` makes a connection pool from the spec.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L65">Source</a></div></div><div class="public" id="var-default-connection"><h3>default-connection</h3><div class="usage"><code>(default-connection conn)</code></div><pre class="doc">Set the database connection that Korma should use by default when no
alternative is specified.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L12">Source</a></div></div><div class="public" id="var-defdb"><h3>defdb</h3><h4 class="macro">macro</h4><div class="usage"><code>(defdb db-name spec)</code></div><pre class="doc">Define a database specification. The last evaluated defdb will be used by
default for all queries where no database is specified by the entity.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L79">Source</a></div></div><div class="public" id="var-delay-pool"><h3>delay-pool</h3><div class="usage"><code>(delay-pool spec)</code></div><pre class="doc">Return a delay for creating a connection pool for the given spec.
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L50">Source</a></div></div><div class="public" id="var-firebird"><h3>firebird</h3><div class="usage"><code>(firebird {:keys [host port db make-pool? encoding], :or {host "localhost", port 3050, db "", make-pool? true, encoding "UTF8"}, :as opts})</code></div><pre class="doc">Create a database specification for a FirebirdSQL database. Opts should include
keys for :db, :user, :password. You can also optionally set host, port, make-pool? and encoding</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L87">Source</a></div></div><div class="public" id="var-get-connection"><h3>get-connection</h3><div class="usage"><code>(get-connection db)</code></div><pre class="doc">Get a connection from the potentially delayed connection object.
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L55">Source</a></div></div><div class="public" id="var-h2"><h3>h2</h3><div class="usage"><code>(h2 {:keys [db make-pool?], :or {db "h2.db", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a h2 database. Opts should include a key
for :db which is the path to the database file.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L203">Source</a></div></div><div class="public" id="var-is-rollback%3F"><h3>is-rollback?</h3><div class="usage"><code>(is-rollback?)</code></div><pre class="doc">Returns true if the current transaction will be rolled back
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L234">Source</a></div></div><div class="public" id="var-msaccess"><h3>msaccess</h3><div class="usage"><code>(msaccess {:keys [db make-pool?], :or {db "", make-pool? false}, :as opts})</code></div><pre class="doc">Create a database specification for a Microsoft Access database. Opts
should include keys for :db and optionally :make-pool?.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L165">Source</a></div></div><div class="public" id="var-mssql"><h3>mssql</h3><div class="usage"><code>(mssql {:keys [user password db host port make-pool?], :or {user "dbuser", password "dbpassword", db "", host "localhost", port 1433, make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a mssql database. Opts should include keys
for :db, :user, and :password. You can also optionally set host and port.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L153">Source</a></div></div><div class="public" id="var-mysql"><h3>mysql</h3><div class="usage"><code>(mysql {:keys [host port db make-pool?], :or {host "localhost", port 3306, db "", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a mysql database. Opts should include keys
for :db, :user, and :password. You can also optionally set host and port.
Delimiters are automatically set to "`".</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L124">Source</a></div></div><div class="public" id="var-odbc"><h3>odbc</h3><div class="usage"><code>(odbc {:keys [dsn make-pool?], :or {dsn "", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for an ODBC DSN. Opts
should include keys for :dsn and optionally :make-pool?.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L179">Source</a></div></div><div class="public" id="var-oracle"><h3>oracle</h3><div class="usage"><code>(oracle {:keys [host port make-pool?], :or {host "localhost", port 1521, make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for an Oracle database. Opts should include keys
for :user and :password. You can also optionally set host and port.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L112">Source</a></div></div><div class="public" id="var-postgres"><h3>postgres</h3><div class="usage"><code>(postgres {:keys [host port db make-pool?], :or {host "localhost", port 5432, db "", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a postgres database. Opts should include
keys for :db, :user, and :password. You can also optionally set host and
port.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L99">Source</a></div></div><div class="public" id="var-rollback"><h3>rollback</h3><div class="usage"><code>(rollback)</code></div><pre class="doc">Tell this current transaction to rollback.
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L229">Source</a></div></div><div class="public" id="var-sqlite3"><h3>sqlite3</h3><div class="usage"><code>(sqlite3 {:keys [db make-pool?], :or {db "sqlite.db", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a SQLite3 database. Opts should include a
key for :db which is the path to the database file.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L191">Source</a></div></div><div class="public" id="var-transaction"><h3>transaction</h3><h4 class="macro">macro</h4><div class="usage"><code>(transaction body)</code><code>(transaction options & body)</code></div><pre class="doc">Execute all queries within the body in a single transaction.
Optionally takes as a first argument a map to specify the :isolation and :read-only? properties of the transaction.</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L215">Source</a></div></div><div class="public" id="var-vertica"><h3>vertica</h3><div class="usage"><code>(vertica {:keys [host port db make-pool?], :or {host "localhost", port 5433, db "", make-pool? true}, :as opts})</code></div><pre class="doc">Create a database specification for a vertica database. Opts should include keys
for :db, :user, and :password. You can also optionally set host and port.
Delimiters are automatically set to "`".</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L138">Source</a></div></div><div class="public" id="var-with-db"><h3>with-db</h3><h4 class="macro">macro</h4><div class="usage"><code>(with-db db & body)</code></div><pre class="doc">Execute all queries within the body using the given db spec
</pre><div class="src-link"><a href="https://github.com/korma/Korma/blob/v0.4.0/src/korma/db.clj#L262">Source</a></div></div></div></body></html>