Created
July 17, 2009 11:40
-
-
Save powellnathanj/149017 to your computer and use it in GitHub Desktop.
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
(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