Back

Executable (clj)

(source)

protocol

Protocol for executing SQL operations. Implementations are provided for `Connection`, `DataSource`, `PreparedStatement`, and `Object`, on the assumption that an `Object` can be turned into a `DataSource` and therefore used to get a `Connection`.

Examples

seancorfield/next-jdbc
(ns ^:no-doc next.jdbc.default-options
  "Implementation of default options logic."
  (:require [next.jdbc.protocols :as p]))

(extend-protocol p/Executable
  DefaultOptions
  (-execute [this sql-params opts]
            (p/-execute (:connectable this) sql-params
                        (merge (:options this) opts)))
  (-execute-one [this sql-params opts]
                (p/-execute-one (:connectable this) sql-params
                                (merge (:options this) opts)))
  (-execute-all [this sql-params opts]
                (p/-execute-all (:connectable this) sql-params
                                (merge (:options this) opts))))