This commit is contained in:
mcy
2019-02-22 17:09:50 +08:00
parent 17efc2ada0
commit fcc1fc78ae

View File

@@ -52,7 +52,7 @@ public class BatchExecutor implements Closeable {
}
public void execute(String sql, List<Map<String, ?>> values) throws SQLException {
PreparedStatement pstmt = getConn().prepareStatement(sql);
try (PreparedStatement pstmt = getConn().prepareStatement(sql)) {
int len = values.size();
for (int i = 0; i < len; i++) {
int type = (Integer) values.get(i).get("type");
@@ -63,6 +63,7 @@ public class BatchExecutor implements Closeable {
pstmt.execute();
idx.incrementAndGet();
}
}
public void commit() throws SQLException {
getConn().commit();