I've been working through the Data Access section of the Clojure in the Wild chapter in Stuart Halloway's Programming Clojure. Here's a MySQL version of the last-created-id form:
(defn last-created-id "Extract the last created id. Must be called in a transaction that performed an insert. MySQL version." [] (:last_created_id (first (sql-query "select LAST_INSERT_ID() as last_created_id"))))
No comments:
Post a Comment