:multi-rs truthy defaults to sequnce; :delimited available #116
This commit is contained in:
parent
ec31aaa427
commit
326977dddc
2 changed files with 15 additions and 8 deletions
|
|
@ -699,8 +699,8 @@
|
|||
(first sql-params)
|
||||
(rest sql-params)
|
||||
opts)]
|
||||
(if (:multi-rs opts)
|
||||
(loop [go (.execute stmt) acc nil rsn 0]
|
||||
(if-let [multi (:multi-rs opts)]
|
||||
(loop [go (.execute stmt) acc (if (= :delimited multi) nil []) rsn 0]
|
||||
(let [rs (if-let [rs (stmt->result-set' stmt go opts)]
|
||||
(datafiable-result-set rs this opts)
|
||||
(let [n (.getUpdateCount stmt)]
|
||||
|
|
@ -710,11 +710,14 @@
|
|||
(if-not rs
|
||||
acc
|
||||
(recur (.getMoreResults stmt)
|
||||
(if acc
|
||||
(-> acc
|
||||
(conj {:next.jdbc/result-set rsn})
|
||||
(into rs))
|
||||
rs)
|
||||
(cond (not= :delimited multi)
|
||||
(conj acc rs)
|
||||
acc
|
||||
(-> acc
|
||||
(conj {:next.jdbc/result-set rsn})
|
||||
(into rs))
|
||||
:else
|
||||
rs)
|
||||
(inc rsn)))))
|
||||
(if-let [rs (stmt->result-set stmt opts)]
|
||||
(datafiable-result-set rs this opts)
|
||||
|
|
|
|||
|
|
@ -315,10 +315,14 @@ VALUES ('Pear', 'green', 49, 47)
|
|||
(when (stored-proc?)
|
||||
(testing "stored proc; multiple result sets"
|
||||
(try
|
||||
(println "====" (:dbtype (db)) "====")
|
||||
(println "====" (:dbtype (db)) "==== true")
|
||||
(clojure.pprint/pprint
|
||||
(jdbc/execute! (ds) [(if (mssql?) "EXEC FRUITP" "CALL FRUITP()")]
|
||||
{:multi-rs true}))
|
||||
(println "====" (:dbtype (db)) "==== :delimited")
|
||||
(clojure.pprint/pprint
|
||||
(jdbc/execute! (ds) [(if (mssql?) "EXEC FRUITP" "CALL FRUITP()")]
|
||||
{:multi-rs :delimited}))
|
||||
(catch Throwable t
|
||||
(println 'call-proc (:dbtype (db)) (ex-message t) (some-> t (ex-cause) (ex-message))))))))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue