protected StatementExecutionResult createExecutionResult(Statement statement, StatementExecutionInput executionInput) throws SQLException {
ResultSet resultSet = statement.getResultSet();
if (resultSet == null) {
statement.close();
StatementExecutionResult executionResult = new StatementExecutionCursorResult(getResultName(), executionInput);
executionResult.updateExecutionMessage(MessageType.INFO, getStatementName() + " executed successfully.");
return executionResult;
} else {
if (executionResult == null) {
return new StatementExecutionCursorResult(getResultName(), executionInput, resultSet);
} else {
// if executionResult exists, just update it with the new resultSet data
if (executionResult instanceof StatementExecutionCursorResult){
StatementExecutionCursorResult executionCursorResult = (StatementExecutionCursorResult) executionResult;
executionCursorResult.setExecutionInput(executionInput);
executionCursorResult.loadResultSet(resultSet);
return executionResult;
} else {
return new StatementExecutionCursorResult(getResultName(), executionInput, resultSet);
}
}
}
}