added better logging to ts upgrade

This commit is contained in:
Dmytro Shvaika 2020-02-27 14:30:14 +02:00 committed by Andrew Shvayka
parent 118c81da5f
commit db65eac638

View File

@ -25,6 +25,7 @@ import java.nio.file.Path;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Types; import java.sql.Types;
@Slf4j @Slf4j
@ -93,6 +94,15 @@ public abstract class AbstractSqlTsDatabaseUpgradeService {
try { try {
CallableStatement callableStatement = conn.prepareCall("{" + query + "}"); CallableStatement callableStatement = conn.prepareCall("{" + query + "}");
callableStatement.execute(); callableStatement.execute();
SQLWarning warnings = callableStatement.getWarnings();
if (warnings != null) {
log.info("{}", warnings.getMessage());
SQLWarning nextWarning = warnings.getNextWarning();
while (nextWarning != null) {
log.info("{}", nextWarning.getMessage());
nextWarning = nextWarning.getNextWarning();
}
}
callableStatement.close(); callableStatement.close();
log.info(SUCCESSFULLY_EXECUTED_FUNCTION, query.replace(CALL_REGEX, "")); log.info(SUCCESSFULLY_EXECUTED_FUNCTION, query.replace(CALL_REGEX, ""));
Thread.sleep(2000); Thread.sleep(2000);