You'd want to use one of the insert functions for that:

(defn add-user [user]
  (sql/with-connection db
    (sql/insert-record :books user)))

http://clojure.github.com/java.jdbc

Allen

On Fri, Jan 6, 2012 at 3:13 PM, jayvandal <s...@ida.net> wrote:
> i am using leinningen  and mysql example. I can select records as:
>
> (defn list-ausers []
>  (sql/with-connection db
>    (sql/with-query-results rows
>
>      ["SELECT * FROM books WHERE BOOK_ID = '1'"]
>      (println rows))))
>
> but I can't insert records,i doesn't like the query as:
>
> (defn add-ausers []
>  (sql/with-connection db
>    ;(sql/with-query-results rows
>
>         sql  ["INSERT INTO books(BOOK_ID, BOOK_NAME, BOOK_PRICE,
> BOOK_AUTHOR) VALUES('2','joe','12', 'siley')"]
>      (println rows)
>
> why or?
>          ;)
>          ))
>
> --
> 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

-- 
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