This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn do-prepared-with-generated-keys | |
"Executes an (optionally parameterized) SQL prepared statement on the | |
open database connection. Each param-group is a seq of values for all of | |
the parameters. #THIS MONKEY PATCH INCLUDES METADATA#" | |
[sql & param-groups] | |
(with-open [stmt (.prepareStatement (connection) sql)] | |
(doseq [param-group param-groups] | |
(doseq [[index value] (map vector (iterate inc 1) param-group)] | |
(.setObject stmt index value)) | |
(.addBatch stmt)) |