Re: Problem with insert-values (clojure.contrib.sql)

2011-09-14 Thread Sean Corfield
On Wed, Sep 14, 2011 at 12:51 AM, finbeu wrote: > Yes, if I understand it correctly, instead of db, I just use the pooled-db > It would be good to have an example that connects the pooled db stuff with > the normal db stuff. Ah, that would make it clearer.. > (defn db-update-or-insert > "Updat

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-14 Thread finbeu
Yes, if I understand it correctly, instead of db, I just use the pooled-db It would be good to have an example that connects the pooled db stuff with the normal db stuff. (defn db-update-or-insert "Updates or inserts a fruit" [record] (sql/with-connection pooled-db (sql/update-or-inser

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 10:43 PM, finbeu wrote: > But how do I use the connectionpool now from clojure.java.jdbc? Did you read that documentation? Does it not provide enough information? Let me know so I can make it better. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfi

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
Sean, thx for the hint. But how do I use the connectionpool now from clojure.java.jdbc? (defn db-update-or-insert "Updates or inserts a fruit" [record] (sql/with-connection db (sql/update-or-insert-values :fruit ["name=?" (:name record)] record))) In my scenario, I just

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 6:49 AM, finbeu wrote: > BTW: Does someone know how I can keep the connection always open? If I > understand it right, "with-connection" does a connect and login to the db > each time it gets called. Isn't this quite inefficient? Take a look at https://github.com/clojure/

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
oh yes. Now it works. Thanks for the quick response! BTW: Does someone know how I can keep the connection always open? If I understand it right, "with-connection" does a connect and login to the db each time it gets called. Isn't this quite inefficient? - Finn -- You received this message

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Meikel Brandmeyer (kotarak)
Hi, comparing the two calls, I suppose you need apply. (def x [[5, "A", 2.0] [6 ,"B", 3.0]]) (sql/with-connection db_spec (apply sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] x)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
Houston, I have a problem: (sql/with-connection db_spec (sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] [5, "A", 2.0] [6 ,"B", 3.0]) This works perfectly fine. Now I'm trying to do the following: (def x [[5, "A", 2.0] [6 ,"B", 3.0]]) (sql/with-connection db_spec