do-commands

clojure.contrib.sql

  • (do-commands & commands)
Executes SQL commands on the open database connection.

1 Example top

  • (clojure.contrib.sql/with-connection conn
      (clojure.contrib.sql/do-commands "INSERT INTO users(id,email) VALUES (1,'bob@example.com')"))
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/sql.clj:81 top

(defn do-commands
  "Executes SQL commands on the open database connection."
  [& commands]
  (with-open [stmt (.createStatement (connection))]
    (doseq [cmd commands]
      (.addBatch stmt cmd))
    (transaction
     (seq (.executeBatch stmt)))))
Vars in clojure.contrib.sql/do-commands: transaction defn doseq seq with-open
Used in 2 other vars drop-table create-table

Comments top

No comments for do-commands. Log in to add a comment.