switch to using put-hints!
This commit is contained in:
parent
a475d0e5c3
commit
2506440c6f
|
@ -1,6 +1,6 @@
|
||||||
(ns views.honeysql.core
|
(ns views.honeysql.core
|
||||||
(:require
|
(:require
|
||||||
[views.core :refer [view-system hint refresh-views!]]
|
[views.core :refer [view-system hint put-hints!]]
|
||||||
[views.honeysql.util :refer [query-tables]]
|
[views.honeysql.util :refer [query-tables]]
|
||||||
[honeysql.core :as hsql]
|
[honeysql.core :as hsql]
|
||||||
[clojure.tools.logging :refer [error]]
|
[clojure.tools.logging :refer [error]]
|
||||||
|
@ -8,10 +8,6 @@
|
||||||
|
|
||||||
(def hint-type :sql-table-name)
|
(def hint-type :sql-table-name)
|
||||||
|
|
||||||
(defn send-hints!
|
|
||||||
[hints]
|
|
||||||
((:put-hints-fn @view-system) hints))
|
|
||||||
|
|
||||||
(defmacro with-view-transaction
|
(defmacro with-view-transaction
|
||||||
"Like jdbc's with-db-transaction, but sends view hints at end of transaction."
|
"Like jdbc's with-db-transaction, but sends view hints at end of transaction."
|
||||||
[binding & forms]
|
[binding & forms]
|
||||||
|
@ -22,7 +18,7 @@
|
||||||
result# (j/with-db-transaction [t# ~db ~@args]
|
result# (j/with-db-transaction [t# ~db ~@args]
|
||||||
(let [~tvar (assoc ~db :hints hints#)]
|
(let [~tvar (assoc ~db :hints hints#)]
|
||||||
~@forms))]
|
~@forms))]
|
||||||
(send-hints! @hints#)
|
(put-hints! @hints#)
|
||||||
result#))))
|
result#))))
|
||||||
|
|
||||||
(defn- execute-honeysql!
|
(defn- execute-honeysql!
|
||||||
|
@ -46,7 +42,7 @@
|
||||||
hsql-hint (hint namespace (query-tables action-map) hint-type)]
|
hsql-hint (hint namespace (query-tables action-map) hint-type)]
|
||||||
(if-let [hints (:hints db)]
|
(if-let [hints (:hints db)]
|
||||||
(swap! hints conj hsql-hint)
|
(swap! hints conj hsql-hint)
|
||||||
(send-hints! [hsql-hint]))
|
(put-hints! [hsql-hint]))
|
||||||
results))
|
results))
|
||||||
([db action-map]
|
([db action-map]
|
||||||
(vexec! db nil action-map)))
|
(vexec! db nil action-map)))
|
||||||
|
|
Loading…
Reference in a new issue