On Tue, May 31, 2011 at 9:35 PM, mmwaikar <mmwai...@gmail.com> wrote:
> So, how do I retrieve individual maps from - (map #(zipmap [:a :b :c :d] %)
> [[1 2 3 4] [5 6 7 8]]) [where :a :b etc. are columns and the second vector
> is values]
> because the above gives me back - ({:d 4, :c 3, :b 2, :a 1} {:d 8, :c 7, :b
> 6, :a 5}) which I cannot pass to the "insert-records" function.

If you have column names and vectors of values like that, you could
use insert-values directly:

(apply clojure.contrib.sql/insert-values [:a :b :c :d] [[1 2 3 4] [5 6 7 8]])

Note that you need apply to "unroll" the vector of vectors into
arguments to the function so that it behaves like this:

(clojure.contrib.sql/insert-values [:a :b :c :d] [1 2 3 4] [5 6 7 8])

Note that, internally, insert-records rearranges the data you pass in
and calls insert-values anyway...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to