Re: Building a jdbc WHERE IN clause

2013-01-28 Thread Jonathon McKitrick
On Friday, January 25, 2013 7:34:29 PM UTC-5, Sean Corfield wrote: Try: (into [sql] ids) That worked perfectly. In the next version of java.jdbc (currently 0.2.4-SNAPSHOT but it will become 0.3.0), you'll be able to simplify your code to this: (sql/query (get-db-spec)

Building a jdbc WHERE IN clause

2013-01-25 Thread Jonathon McKitrick
I saw a post some time ago answering this question, and here are three solutions. I thought the first would be the most elegant. But for some reason, the first does not work, and returns an empty set. I'm trying to understand what's wrong with it. (defn get-by-ids-test [ids] (let [qs

Re: Building a jdbc WHERE IN clause

2013-01-25 Thread Sean Corfield
On Fri, Jan 25, 2013 at 2:27 PM, Jonathon McKitrick jmckitr...@gmail.com wrote: (defn get-by-ids-test [ids] (let [qs (string/join , (repeat (count ids) ?)) sql (str select * from survey where survey_id in ( qs ))] (println SQL sql) (println ids ids)