Source:
<code>public static List<String> getCommandsFromScript(final File script, final DatabaseType databaseType) throws IOException { String delimiter = getDelimiterByFileAndDatabase(script, databaseType); String escapedDelimiter = DELIMITER_STANDARD.equals(delimiter) ? "\\" + DELIMITER_STANDARD : delimiter; final List<String> scriptLines = FileUtils.readLines(script, StandardCharsets.UTF_8); final List<String> foundCommands = new ArrayList<String>(); final StringBuilder command = new StringBuilder(); int pgBlockCounter = 0; for (String line : scriptLines) { final String trimmedLine = line.trim(); if ("".equals(trimmedLine) || trimmedLine.startsWith("--") || trimmedLine.startsWith("#") || (trimmedLine.startsWith("/*"))) { continue; } if (databaseType == POSTGRESQL && trimmedLine.matches(DOLLAR_QUOTED_BLOCK)) { pgBlockCounter++; } if (trimmedLine.equals(delimiter)) { if (!"".equals(command.toString())) { foundCommands.add(command.toString()); command.setLength(0); command.trimToSize(); } } <START> if (databaseType == SYBASE && !trimmedLine.startsWith(delimiter) && trimmedLine.contains(delimiter)){ <END> command.append(trimmedLine).append(" "); } else if ((trimmedLine.contains(delimiter) && databaseType != POSTGRESQL) || trimmedLine.contains(delimiter) && databaseType == POSTGRESQL && isEven(pgBlockCounter)) { extractCommandsFromLine(trimmedLine, escapedDelimiter, command, foundCommands); } else { command.append(trimmedLine).append(" "); } } if (!"".equals(command.toString())) { foundCommands.add(command.toString()); } return foundCommands; }</code><technical_language>delimiter beginning of line? is this step necessary? I omit !trimmedLine.startsWith(delimiter) happen beginning of line start go, e.g. column definition column name goal. include && databaseType != SYBASE in next else if. e.g. else if ((trimmedLine.contains(delimiter) && databaseType != POSTGRESQL && databaseType != SYBASE) || trimmedLine.contains(delimiter) && databaseType == POSTGRESQL && isEven(pgBlockCounter)) case is in middle of line covered next else wdyt</technical_language>

Target:
public static List<String> getCommandsFromScript(final File script, final DatabaseType databaseType) throws IOException { String delimiterRegex = getDelimiterByFileAndDatabase(script, databaseType); String delimiter = delimiterRegex.indexOf(REGEX_OR)!=-1 ? delimiterRegex.substring(0, delimiterRegex.indexOf(REGEX_OR)) : delimiterRegex; String escapedDelimiter = DELIMITER_STANDARD.equals(delimiter) ? "\\" + DELIMITER_STANDARD : delimiter; final List<String> scriptLines = FileUtils.readLines(script, StandardCharsets.UTF_8); final List<String> foundCommands = new ArrayList<String>(); final StringBuilder command = new StringBuilder(); int pgBlockCounter = 0; for (String line : scriptLines) { final String trimmedLine = line.trim(); if (shouldSkip(trimmedLine)) { continue; } if (databaseType == POSTGRESQL && trimmedLine.matches(DOLLAR_QUOTED_BLOCK)) { pgBlockCounter++; } if (trimmedLine.toUpperCase().matches(delimiterRegex)) { if (!"".equals(command.toString())) { foundCommands.add(command.toString()); command.setLength(0); command.trimToSize(); continue; } } if ((trimmedLine.contains(delimiter) && databaseType != POSTGRESQL && databaseType != SYBASE) || trimmedLine.contains(delimiter) && databaseType == POSTGRESQL && isEven(pgBlockCounter)) { extractCommandsFromLine(trimmedLine, escapedDelimiter, command, foundCommands); } else { command.append(trimmedLine).append(" "); } } if (!"".equals(command.toString())) { foundCommands.add(command.toString()); } return foundCommands; }