Support multiple result sets?
Description
Environment
Activity
I do not intend to tackle this within clojure.java.jdbc
. I may tackle it within next.jdbc
at some future point.
Note: any patch for this now needs to take into account the reducible version of the result set as well as the regular version.
No update yet. No one has submitted a patch and I've been too busy to look at this in detail.
Comment made by: r00t
Any updates on the issue?
Discussion with Pieter Laeremans:
Sean: My thinking is that I would add :multi-result? to execute! and query and then arrange for them to return sequences of result sets. Unraveling the calls so multi-result? can work cleanly inside those functions would be the hard part
Pieter: That sounds fine by me. But there's something a bit more subtle I guess,
Now you can pass a function row-fn to transform rows, in the multi-resultset case it would perhaps be more appropriate
to pass on a seq of row-fns, so that a different function can be used on different rows.
Details
Details
Assignee
Reporter
Priority

Useful for stored procedure results:
call_proc.clj
(defn call-stored-proc [connection] (jdbc/query (myapp.db/connection) ["{call someProc()}"] :as-arrays? true))
Java code to handle multiple result sets:
MultiResults.java
public static void executeProcedure(Connection con) { try { CallableStatement stmt = con.prepareCall(...); ..... //Set call parameters, if you have IN,OUT, or IN/OUT parameters boolean results = stmt.execute(); int rsCount = 0; //Loop through the available result sets. while (results) { ResultSet rs = stmt.getResultSet(); //Retrieve data from the result set. while (rs.next()) { ....// using rs.getxxx() method to retieve data } rs.close(); //Check for next result set results = stmt.getMoreResults(); } stmt.close(); } catch (Exception e) { e.printStackTrace(); } }