updates for recent views changes
This commit is contained in:
parent
9de07f22ef
commit
4a3916d25f
|
@ -1,4 +1,6 @@
|
|||
(ns views.honeysql.core
|
||||
(:import
|
||||
(clojure.lang Atom))
|
||||
(:require
|
||||
[views.core :refer [view-system hint put-hints!]]
|
||||
[views.honeysql.util :refer [query-tables]]
|
||||
|
@ -13,7 +15,7 @@
|
|||
vexec! calls which need to be run in a transaction. Holds all view system hints
|
||||
generated by any vexec! calls within the transaction until the end, at which point
|
||||
they are all sent to the view system."
|
||||
[binding & forms]
|
||||
[^Atom view-system binding & forms]
|
||||
(let [tvar (first binding)
|
||||
db (second binding)
|
||||
args (drop 2 binding)]
|
||||
|
@ -23,7 +25,7 @@
|
|||
result# (j/with-db-transaction [t# ~db ~@args]
|
||||
(let [~tvar (assoc ~db :views-honeysql/hints hints#)]
|
||||
~@forms))]
|
||||
(put-hints! @hints#)
|
||||
(put-hints! view-system @hints#)
|
||||
result#))))
|
||||
|
||||
(defn- execute-honeysql!
|
||||
|
@ -46,12 +48,12 @@
|
|||
- db: a clojure.java.jdbc database connection
|
||||
- namespace (optional): a namespace that will be included in the hints sent out
|
||||
- action-map: the HoneySQL map for the insert/update/delete SQL query"
|
||||
([db namespace action-map]
|
||||
([^Atom view-system db namespace action-map]
|
||||
(let [results (execute-honeysql! db action-map)
|
||||
hsql-hint (hint namespace (query-tables action-map) hint-type)]
|
||||
(if-let [hints (:views-honeysql/hints db)]
|
||||
(swap! hints conj hsql-hint)
|
||||
(put-hints! [hsql-hint]))
|
||||
(put-hints! view-system [hsql-hint]))
|
||||
results))
|
||||
([db action-map]
|
||||
(vexec! db nil action-map)))
|
||||
([^Atom view-system db action-map]
|
||||
(vexec! view-system db nil action-map)))
|
||||
|
|
Loading…
Reference in a new issue