From: SVN by r. <sv...@ca...> - 2009-01-17 14:55:45
|
Author: roy Date: 2009-01-17 15:55:32 +0100 (Sat, 17 Jan 2009) New Revision: 353 Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java Log: fix parsing of sqlcommands when using batch commands Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java =================================================================== --- src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-01-16 20:58:47 UTC (rev 352) +++ src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-01-17 14:55:32 UTC (rev 353) @@ -2083,7 +2083,7 @@ fin = new FileInputStream(toFileName(command.substring(1))); sqlShell.output("Reading file: "+ toFileName(command.substring(1))); BufferedReader reader = new BufferedReader(new InputStreamReader(fin)); - StringBuffer cmd = new StringBuffer(); + SQLCommand sqlCmd = new SQLCommand(); String line; int errorCount = 0; while ( ((line = reader.readLine()) != null)) { @@ -2093,8 +2093,8 @@ if (line.startsWith("--")) { continue; } - cmd.append(line); - String commandString = cmd.toString(); + sqlCmd.getEditableLines().add(new StringBuffer(line)); + String commandString = sqlCmd.getUntrimmedCommandString(); currentCommand = sqlShell.createCommand(commandString); if (currentCommand == null) { continue; @@ -2116,7 +2116,7 @@ errorCount++; sqlShell.error(e); } - cmd=new StringBuffer(); + sqlCmd=new SQLCommand(); new Thread() { @Override public void run() { @@ -2127,8 +2127,8 @@ if (cancelled) { return new SimpleCommandResult(true, "Execution of file '" + toFileName(command.substring(1)) +"' aborted...."); } - if (cmd.toString().trim().length() > 0) { - return new SimpleCommandResult(false, "File '"+ toFileName(command.substring(1)) +"' missing a ';' at the end of the last command"); + if (sqlCmd.getCommandString().trim().length() > 0) { + return new SimpleCommandResult(false, "File '"+ toFileName(command.substring(1)) +"' missing a ';' at the end of the last command (" + sqlCmd.getUntrimmedCommandString()+")"); } else { return new SimpleCommandResult(true, "File '" + toFileName(command.substring(1)) +"' executed " + (errorCount > 0 ? "with "+ errorCount+" errors." : "successfully.")); } |