Do you want that specific piece of (procedural) Java converted to
Clojure or do you have a real use case in the context of a real
problem that you're trying to solve?

I suspect just showing you what that piece of Java would look like in
Clojure isn't going to teach you how to do this in general... and
there are multiple approaches that would each be more suitable to
particular real world problems.

Sean

On Sun, Dec 8, 2013 at 9:44 AM, Avinash Dongre <dongre.avin...@gmail.com> wrote:
> I see following example in Clojure.java.jdbc
>
> (sql/db-do-prepared db "INSERT INTO fruit2 ( name, appearance, cost, grade )
> VALUES ( ?, ?, ?, ? )" ["test" "test" 1 1.0])
>
> But how do i convert following java code into clojure. I am new to clojure
> and not sure how to i pass multiple vector
>
> final int numRows = 10000;
>     PreparedStatement pstmt = conn
>         .prepareStatement("insert into new_order values (?, ?, ?)");
>     for (int id = 1; id <= numRows; id++) {
>       pstmt.setInt(1, id % 98);
>       pstmt.setInt(2, id % 98);
>       pstmt.setInt(3, id);
>       int count;
>       if ((count = pstmt.executeUpdate()) != 1) {
>         System.err.println("unexpected update count for a single insert " +
> count);
>         System.exit(2);
>       }
>       if ((id % 500) == 0) {
>         System.out.println("Completed " + id + " inserts ...");
>       }
>     }
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to