我在以下示例中看到Clojure.java.jdbc
(sql/db-do-prepared db "INSERT INTO fruit2 ( name, appearance, cost, grade ) VALUES ( ?, ?, ?, ? )" ["test" "test" 1 1.0])
但是我如何将以下 java
代码转换为clojure
. 我是新手clojure
,不知道如何通过多个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 ...");
}
}