mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fix #1521
This commit is contained in:
@@ -52,16 +52,17 @@ public class BatchExecutor implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void execute(String sql, List<Map<String, ?>> values) throws SQLException {
|
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();
|
int len = values.size();
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
int type = (Integer) values.get(i).get("type");
|
int type = (Integer) values.get(i).get("type");
|
||||||
Object value = values.get(i).get("value");
|
Object value = values.get(i).get("value");
|
||||||
SyncUtil.setPStmt(type, pstmt, value, i + 1);
|
SyncUtil.setPStmt(type, pstmt, value, i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pstmt.execute();
|
pstmt.execute();
|
||||||
idx.incrementAndGet();
|
idx.incrementAndGet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commit() throws SQLException {
|
public void commit() throws SQLException {
|
||||||
|
|||||||
Reference in New Issue
Block a user