diff --git a/src/views/honeysql/core.clj b/src/views/honeysql/core.clj index a2e4c09..31e4c6c 100644 --- a/src/views/honeysql/core.clj +++ b/src/views/honeysql/core.clj @@ -46,14 +46,14 @@ Arguments are: - 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" - ([^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! view-system [hsql-hint])) - results)) - ([^Atom view-system db action-map] - (vexec! view-system db nil action-map))) + - action-map: the HoneySQL map for the insert/update/delete SQL query + + Options are: + - namespace: a namespace that will be included in the hints sent out" + [^Atom view-system db action-map & [{:keys [namespace] :as options}]] + (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! view-system [hsql-hint])) + results)) diff --git a/test/views/honeysql/vexec_tests.clj b/test/views/honeysql/vexec_tests.clj index a0dde78..7810bb9 100644 --- a/test/views/honeysql/vexec_tests.clj +++ b/test/views/honeysql/vexec_tests.clj @@ -30,7 +30,7 @@ (deftest namespace-is-passed-along-to-hints-via-vexec (let [sql {:insert-into :example :values [{:field1 "test" :field2 "N" :field3 nil}]} - result (vexec! test-view-system test-db :foobar sql)] + result (vexec! test-view-system test-db sql {:namespace :foobar})] (is (called-with-args? :jdbc/insert! test-db (:insert-into sql) (first (:values sql)))) (is (= :jdbc/insert!-return-value result)) (is (called-with-args? :views/put-hints! test-view-system [(views/hint :foobar #{:example} hint-type)]))))