### Get Database Connection Source: https://korma.github.io/Korma/korma Retrieves a database connection from a potentially delayed connection object. This ensures the connection is established only when needed. ```clojure (get-connection db) ``` -------------------------------- ### Create PostgreSQL Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for PostgreSQL. Requires `:db`, `:user`, and `:password`. Host and port can be optionally specified, with defaults for host and port. ```clojure (postgres {:keys [host port db], :or {host "localhost", port 5432, db ""}, :as opts}) ``` -------------------------------- ### Create MySQL Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for MySQL. Requires `:db`, `:user`, and `:password`. Host and port can be optionally specified, with defaults for host and port. Backticks are used as delimiters. ```clojure (mysql {:keys [host port db], :or {host "localhost", port 3306, db ""}, :as opts}) ``` -------------------------------- ### Create MSSQL Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for Microsoft SQL Server. Requires `:db`, `:user`, and `:password`. Host and port can be optionally specified, with defaults for host and port. ```clojure (mssql {:keys [user password db host port], :or {user "dbuser", password "dbpassword", db "", host "localhost", port 1433}, :as opts}) ``` -------------------------------- ### Create Oracle Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for Oracle. Requires `:user` and `:password`. Host and port can be optionally specified, with defaults for host and port. ```clojure (oracle {:keys [host port], :or {host "localhost", port 1521}, :as opts}) ``` -------------------------------- ### Create Vertica Database Specification (Clojure) Source: https://korma.github.io/Korma/korma Creates a database specification for a Vertica database. Requires `:db`, `:user`, and `:password` in the `opts` map. Host and port can also be specified. Delimiters are set to '`'. ```clojure (vertica {:keys [host port db], :or {host "localhost", port 5433, db ""}, :as opts}) ``` -------------------------------- ### Create FirebirdSQL Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for FirebirdSQL. It accepts options for host, port, and database name, with defaults for host and port. User and password must be provided in the options. ```clojure (firebird {:keys [host port db], :or {host "localhost", port 3050, db ""}, :as opts}) ``` -------------------------------- ### Create SQLite3 Database Specification (Clojure) Source: https://korma.github.io/Korma/korma Creates a database specification for a SQLite3 database. The `db` option specifies the path to the database file. Other options can be passed via the `opts` map. ```clojure (sqlite3 {:keys [db], :or {db "sqlite.db"}, :as opts}) ``` -------------------------------- ### Create Microsoft Access Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for Microsoft Access. Requires the `:db` key for the database file path. Optionally supports `:make-pool?` for connection pooling. ```clojure (msaccess {:keys [db], :or {db ""}, :as opts}) ``` -------------------------------- ### Create Database Connection Source: https://korma.github.io/Korma/korma Manually creates a database connection object, useful for dynamic connections. It can optionally create a connection pool if the spec includes `:make-pool? true`. It's recommended to follow this with `(default-connection my-new-conn)`. ```clojure (create-db spec) ``` -------------------------------- ### Create H2 Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for an H2 database. The primary option is `:db`, which specifies the path to the database file. Defaults to 'h2.db'. ```clojure (h2 {:keys [db], :or {db "h2.db"}, :as opts}) ``` -------------------------------- ### Create ODBC Database Spec Source: https://korma.github.io/Korma/korma Creates a database specification for an ODBC Data Source Name (DSN). Requires the `:dsn` key. Optionally supports `:make-pool?` for connection pooling. ```clojure (odbc {:keys [dsn], :or {dsn ""}, :as opts}) ``` -------------------------------- ### Define Database Specification Source: https://korma.github.io/Korma/korma Defines a database specification using a macro. The last defined database specification will be used as the default for queries that do not specify an alternative database. ```clojure (defdb db-name spec) ``` -------------------------------- ### Create Connection Pool Source: https://korma.github.io/Korma/korma Creates a connection pool for a given database specification. It accepts various options for pool configuration, such as connection URI, timeouts, and pool sizes. Defaults are provided for most parameters. ```clojure (connection-pool {:keys [connection-uri subprotocol subname classname excess-timeout idle-timeout initial-pool-size minimum-pool-size maximum-pool-size test-connection-query idle-connection-test-period test-connection-on-checkin test-connection-on-checkout], :or {maximum-pool-size 15, idle-timeout (* 3 60 60), excess-timeout (* 30 60), idle-connection-test-period 0, test-connection-query nil, test-connection-on-checkin false, test-connection-on-checkout false, initial-pool-size 3, minimum-pool-size 3}, :as spec}) ``` -------------------------------- ### Korma Core Querying Functions Source: https://korma.github.io/Korma/index Provides core functions for building and executing SQL queries in Korma. This namespace includes functions for selecting, inserting, updating, deleting, joining, and aggregating data. ```Clojure ;; Core querying and entity functions ;; Public variables and functions: ;; *exec-mode* ;; add-comment ;; add-joins ;; aggregate ;; as-sql ;; assoc-db-to-entity ;; belongs-to ;; create-entity ;; create-relation ;; database ;; defentity ;; delete ;; delete* ;; dry-run ;; empty-query ;; entity-fields ;; entity? ;; exec ;; exec-raw ;; fields ;; fk ;; from ;; get-rel ;; group ;; has-many ;; has-one ;; having ;; having* ;; insert ;; insert* ;; intersect ;; intersect* ;; join ;; join* ;; lfk ;; limit ;; many-to-many ;; many-to-many-fn ;; modifier ;; offset ;; order ;; pk ;; post-query ;; prepare ;; queries ;; query-only ;; raw ;; rel ;; rfk ;; select ;; select* ;; set-fields ;; sql-only ;; sqlfn ;; sqlfn* ;; subselect ;; table ;; transform ;; union ;; union* ;; union-all ;; union-all* ;; update ;; update* ;; values ;; where ;; where* ;; with ;; with* ;; with-batch ;; with-batch* ``` -------------------------------- ### Execute Query Source: https://korma.github.io/Korma/korma Executes a query against a specified database. The query map can include a `:db` key to specify the database connection. ```clojure (do-query {:keys [db], :as query}) ``` -------------------------------- ### Korma Database Specification Functions Source: https://korma.github.io/Korma/index Manages the creation and configuration of database connections and specifications within Korma. This namespace includes functions for defining databases, managing connection pools, and handling transactions. ```Clojure ;; Functions for creating and managing database specifications. ;; Public variables and functions: ;; *current-conn* ;; *current-db* ;; _default ;; c3p0-enabled? ;; connection-pool ;; create-db ;; default-connection ;; defdb ;; delay-pool ;; do-query ;; extract-options ;; firebird ;; get-connection ;; h2 ;; is-rollback? ;; msaccess ;; mssql ;; mysql ;; odbc ;; oracle ;; postgres ;; resolve-new ;; rollback ;; sqlite3 ;; transaction ;; vertica ;; with-db ``` -------------------------------- ### Execute Queries with a Specific Database (Clojure) Source: https://korma.github.io/Korma/korma Executes all queries within the body using the provided database specification (`db`). This macro ensures that the specified database connection is used for the enclosed operations. ```clojure (with-db db & body) ``` -------------------------------- ### Create Connection Pool Delay Source: https://korma.github.io/Korma/korma Returns a delay object for creating a connection pool for the given database specification. This allows for lazy initialization of the connection pool. ```clojure (delay-pool spec) ``` -------------------------------- ### Set Default Connection Source: https://korma.github.io/Korma/korma Sets the default database connection that Korma will use for queries when no specific database is provided. ```clojure (default-connection conn) ``` -------------------------------- ### Extract Options Source: https://korma.github.io/Korma/korma Extracts naming and delimiter options from a given map. This function is useful for customizing how identifiers are handled. ```clojure (extract-options {:keys [naming delimiters alias-delimiter]}) ``` -------------------------------- ### Resolve New Class Source: https://korma.github.io/Korma/korma A macro used to resolve a new class, likely for dynamic instantiation or type checking within Korma. ```clojure (resolve-new class) ``` -------------------------------- ### Execute Queries in a Transaction (Clojure) Source: https://korma.github.io/Korma/korma Executes all queries within the body in a single transaction. Optionally accepts a map for transaction properties like `:isolation` and `:read-only?`. ```clojure (transaction body) (transaction options & body) ``` -------------------------------- ### Check Rollback Status Source: https://korma.github.io/Korma/korma Returns `true` if the current transaction is marked for rollback, and `false` otherwise. ```clojure (is-rollback?) ``` -------------------------------- ### Rollback Transaction Source: https://korma.github.io/Korma/korma Initiates a rollback for the current transaction. This function signals that any changes made within the transaction should be discarded. ```clojure (rollback) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.