use of org.jkiss.dbeaver.model.sql.exec.SQLScriptProcessor in project dbeaver by serge-rider.
the class SQLScriptExecuteHandler method processScript.
private void processScript(DBRProgressMonitor monitor, DBTTask task, SQLScriptExecuteSettings settings, DBCExecutionContext executionContext, String filePath, String sqlScriptContent, Log log, PrintStream logStream) throws DBException {
PrintWriter logWriter = new PrintWriter(logStream, true);
List<SQLScriptElement> scriptElements = SQLScriptParser.parseScript(executionContext, sqlScriptContent);
SQLScriptContext scriptContext = new SQLScriptContext(null, () -> executionContext, null, logWriter, null);
scriptContext.setVariables(DBTaskUtils.getVariables(task));
SQLScriptDataReceiver dataReceiver = new SQLScriptDataReceiver();
SQLScriptProcessor scriptProcessor = new SQLScriptProcessor(executionContext, scriptElements, scriptContext, dataReceiver, log);
scriptProcessor.setCommitType(settings.isAutoCommit() ? SQLScriptCommitType.AUTOCOMMIT : SQLScriptCommitType.AT_END);
scriptProcessor.setErrorHandling(settings.isIgnoreErrors() ? SQLScriptErrorHandling.IGNORE : SQLScriptErrorHandling.STOP_ROLLBACK);
if (settings.isDumpQueryResultsToLog()) {
dataReceiver.setDumpWriter(logWriter);
}
scriptProcessor.runScript(monitor);
}
Aggregations