Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Created May 17, 2011 21:46
Get methods
(def get-all-nominees "select * from nominees")
(defn get-sql
"Generic select statement functionality"
[sql-stmt]
(with-connection db
(sql/with-query-results results sql-stmt
(doall results))))
(defn get-nominees
([] (get-sql [get-all-nominees]))
([year] (get-sql [(str get-all-nominees " where year=?") year])))
(defn get-winners
([] (get-sql [(str get-all-nominees " where winner=1")]))
([year] (get-sql [(str get-all-nominees " where winner=1 and year=?") year])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment