Created
May 17, 2011 21:46
Get methods
This file contains hidden or 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
(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