execute(executionInput, connection);
}
}
public void execute(MethodExecutionInput executionInput, Connection connection) throws SQLException {
ConnectionHandler connectionHandler = null;
boolean usePoolConnection = false;
try {
long startTime = System.currentTimeMillis();
String command = buildExecutionCommand(executionInput);
T method = getMethod();
if (method != null) {
connectionHandler = method.getConnectionHandler();
usePoolConnection = executionInput.isUsePoolConnection();
CallableStatement callableStatement = connection.prepareCall (command);
prepareCall(executionInput, callableStatement);
callableStatement.execute();
callableStatement.setQueryTimeout(10);
if (!usePoolConnection) connectionHandler.notifyChanges(method.getVirtualFile());
MethodExecutionResult executionResult = executionInput.getExecutionResult();
if (executionResult != null) {
loadValues(executionResult, callableStatement);
executionResult.setExecutionDuration((int) (System.currentTimeMillis() - startTime));
}
}
} finally {
if (executionInput.isCommitAfterExecution()) {
if (usePoolConnection) {
connection.commit();
} else {
if (connectionHandler != null) connectionHandler.commit();
}
}
if (connectionHandler != null && usePoolConnection) connectionHandler.freePoolConnection(connection);
}
}