From: SVN by r. <sv...@ca...> - 2008-02-27 09:07:48
|
Author: roy Date: 2008-02-27 10:07:38 +0100 (Wed, 27 Feb 2008) New Revision: 240 Modified: src/main/java/nl/improved/sqlclient/SQLShell.java Log: some abort fixes for batchcommand Modified: src/main/java/nl/improved/sqlclient/SQLShell.java =================================================================== --- src/main/java/nl/improved/sqlclient/SQLShell.java 2008-02-26 20:43:14 UTC (rev 239) +++ src/main/java/nl/improved/sqlclient/SQLShell.java 2008-02-27 09:07:38 UTC (rev 240) @@ -1354,10 +1354,12 @@ } private class ExecuteBatchCommand implements Command { - private boolean cancelled = false; + private boolean cancelled; + private Command currentCommand; @Override public CharSequence execute(SQLCommand sqlCommand) { cancelled = false; + currentCommand = null; String command = sqlCommand.getCommandString(); // read file from file system and execute FileInputStream fin = null; @@ -1388,6 +1390,9 @@ error(e); } finally { if (fin != null) try { fin.close();}catch(Exception e) {/*ignore*/} + if (cancelled) { + return "Execution of file '" + toFileName(command.substring(1)) +"' aborted...."; + } return "File '" + toFileName(command.substring(1)) +"' executed successfully."; } } @@ -1437,8 +1442,12 @@ @Override public boolean abort() { cancelled = true; + if (currentCommand != null) { + currentCommand.abort(); + } return true; } + @Override public boolean backgroundProcessSupported() { return true; |