if (row.value != null) {
statement.setString(1, convertDebtForDays(row.value));
} else {
- statement.setNull(1, Types.NULL);
+ statement.setNull(1, Types.DOUBLE);
}
- statement.setDouble(2, row.id);
+ statement.setLong(2, row.id);
}
}
);
return Long.toString(workDurationConvertor.createFromDays(data));
}
- private class Row {
+ private static class Row {
Long id;
Double value;
}
if (row.changeData != null) {
statement.setString(1, convertChangelog(row.changeData));
} else {
- statement.setNull(1, Types.NULL);
+ statement.setNull(1, Types.VARCHAR);
}
statement.setDate(2, new Date(system2.now()));
- statement.setDouble(3, row.id);
+ statement.setLong(3, row.id);
}
}
);
return sb.toString();
}
- private class Row {
+ private static class Row {
Long id;
String changeData;
}
public void convert(Row row, PreparedStatement statement) throws SQLException {
statement.setLong(1, workDurationConvertor.createFromLong(row.debt));
statement.setDate(2, new Date(system2.now()));
- statement.setDouble(3, row.id);
+ statement.setLong(3, row.id);
}
}
);
}
- private class Row {
+ private static class Row {
Long id;
Long debt;
}
}
public <S> void execute(InputLoader<S> inputLoader, InputConverter<S> converter) {
+ int count = 0;
try {
Connection readConnection = db.getDataSource().getConnection();
Statement stmt = null;
writeStatement.addBatch();
cursor++;
+ count++;
if (cursor == GROUP_SIZE) {
writeStatement.executeBatch();
writeConnection.commit();
writeStatement.executeBatch();
writeConnection.commit();
}
-
} finally {
if (writeStatement != null) {
writeStatement.close();
}
DbUtils.closeQuietly(writeConnection);
DbUtils.closeQuietly(readConnection, stmt, rs);
+
+ logger.info("{} rows have been updated", count);
}
} catch (SQLException e) {
logger.error(FAILURE_MESSAGE, e);
setDouble(statement, 4, row.var3);
setDouble(statement, 5, row.var4);
setDouble(statement, 6, row.var5);
- statement.setDouble(7, row.id);
+ statement.setLong(7, row.id);
}
}
);
if (value != null) {
statement.setDouble(index, convertDebtForDays(value));
} else {
- statement.setNull(index, Types.NULL);
+ statement.setNull(index, Types.DOUBLE);
}
}
return workDurationConvertor.createFromDays(data);
}
- private class Row {
+ private static class Row {
Long id;
Double value;
Double var1;