diff --git a/CHANGELOG.md b/CHANGELOG.md index c5cc0a6..c49400e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ Only accretive/fixative changes will be made from now on. +* 1.3.next in progress + * Fix [#287](https://github.com/seancorfield/next-jdbc/issues/287) by merging user-supplied options over `:return-keys true`. + * 1.3.955 -- 2024-10-06 * Address [#285](https://github.com/seancorfield/next-jdbc/issues/285) by setting the default Clojure version to the earliest supported (1.10.3) to give a better hint to users. * Update PostgreSQL **Tips & Tricks** example code to fix possible NPE. PR [#284](https://github.com/seancorfield/next-jdbc/pull/284) from [@ExNexu](https://github.com/ExNexu). diff --git a/src/next/jdbc/result_set.clj b/src/next/jdbc/result_set.clj index 5810507..5525a22 100644 --- a/src/next/jdbc/result_set.clj +++ b/src/next/jdbc/result_set.clj @@ -952,14 +952,14 @@ (reify clojure.lang.IReduceInit (reduce [_ f init] - (reduce-stmt this f init (assoc opts :return-keys true))) + (reduce-stmt this f init (merge {:return-keys true} opts))) r/CollFold (coll-fold [_ n combinef reducef] (fold-stmt this n combinef reducef (.getConnection this) - (assoc opts :return-keys true))) + (merge {:return-keys true} opts))) (toString [_] "`IReduceInit` from `plan` -- missing reduction?"))) (-execute-one [this _ opts] - (if-let [rs (stmt->result-set this (assoc opts :return-keys true))] + (if-let [rs (stmt->result-set this (merge {:return-keys true} opts))] (let [builder-fn (get opts :builder-fn as-maps) builder (builder-fn rs opts)] (when (.next rs) @@ -970,10 +970,10 @@ (if (:multi-rs opts) (loop [go (.execute this) acc []] (if-let [rs (stmt->result-set-update-count - (.getConnection this) this go (assoc opts :return-keys true))] + (.getConnection this) this go (merge {:return-keys true} opts))] (recur (.getMoreResults this) (conj acc rs)) acc)) - (if-let [rs (stmt->result-set this (assoc opts :return-keys true))] + (if-let [rs (stmt->result-set this (merge {:return-keys true} opts))] (datafiable-result-set rs (.getConnection this) opts) [{:next.jdbc/update-count (.getUpdateCount this)}]))) @@ -1006,7 +1006,7 @@ (if (:multi-rs opts) (loop [go (.execute this (first sql-params)) acc []] (if-let [rs (stmt->result-set-update-count - (.getConnection this) this go (assoc opts :return-keys true))] + (.getConnection this) this go (merge {:return-keys true} opts))] (recur (.getMoreResults this) (conj acc rs)) acc)) (if-let [rs (stmt-sql->result-set this (first sql-params))]