A class to parse a SQL script and return the individual commands
in the script. The actual parsing is done by using an instance
of
IteratingScriptParser author: support@sql-workbench.net
Get the starting offset in the original script for the command indicated by index
getIndexInCommand
public int getIndexInCommand(int commandIndex, int cursorPos)(Code)
Return the index from the overall script mapped to the
index inside the specified command. For a single command
script scriptCursorLocation will be the same as
the location inside the dedicated command.
Parameters: commandIndex - the index for the command to check Parameters: cursorPos - the index in the overall script the relative index inside the command
Sets the alternate delimiter. This implies that
by default the semicolon is used, and only if
the alternate delimiter is detected, that will be used.
If only one delimiter should be used (and no automatic checking
for an alternate delimiter), use
ScriptParser.setDelimiter(DelimiterDefinition)
setAlternateLineComment
public void setAlternateLineComment(String comment)(Code)
setCheckEscapedQuotes
public void setCheckEscapedQuotes(boolean flag)(Code)
Check for quote characters that are escaped using a
backslash. If turned on (flag == true) the following
SQL statement would be valid (different to the SQL standard):
INSERT INTO myTable (column1) VALUES ('Arthurs\'s house');
but the following Script would generate an error:
INSERT INTO myTable (file_path) VALUES ('c:\');
because the last quote would not bee seen as a closing quote
setCheckForSingleLineCommands
public void setCheckForSingleLineCommands(boolean flag)(Code)
Define the delimiters to be used. If the (in-memory) script ends with
the defined alternate delimiter, then the alternate is used, otherwise
the default
Define the script to be parsed.
The delimiter to be used will be checked automatically
First the it will check if the script ends with the alternate delimiter
if this is not the case, the script will be checked if it ends with GO
If so, GO will be used (MS SQL Server script style)
If none of the above is true, ; (semicolon) will be used
setSupportOracleInclude
public void setSupportOracleInclude(boolean flag)(Code)