Skip to content

Instantly share code, notes, and snippets.

@powellnathanj
Created July 17, 2009 11:40
Show Gist options
  • Save powellnathanj/149017 to your computer and use it in GitHub Desktop.
Save powellnathanj/149017 to your computer and use it in GitHub Desktop.
(require '[clojure.contrib.sql :as ccsql])
(def db { :classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost/hack"
:user "root"
:create true })
(defn get-star
"Print all the rows in the table"
[table]
(ccsql/with-connection db
(ccsql/with-query-results res
[(str "SELECT * FROM " table)]
(doseq [rec res]
(println rec)))))
(get-star "hack")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment