(StringBuilder command, String line)
| 230 | } |
| 231 | |
| 232 | private StringBuilder handleLine(StringBuilder command, String line) throws SQLException, UnsupportedEncodingException { |
| 233 | String trimmedLine = line.trim(); |
| 234 | if (lineIsComment(trimmedLine)) { |
| 235 | final String cleanedString = trimmedLine.substring(2).trim().replaceFirst("//", ""); |
| 236 | if(cleanedString.toUpperCase().startsWith("@DELIMITER")) { |
| 237 | delimiter = cleanedString.substring(11,12); |
| 238 | return command; |
| 239 | } |
| 240 | println(trimmedLine); |
| 241 | } else if (commandReadyToExecute(trimmedLine)) { |
| 242 | command.append(line.substring(0, line.lastIndexOf(delimiter))); |
| 243 | command.append(LINE_SEPARATOR); |
| 244 | println(command); |
| 245 | executeStatement(command.toString()); |
| 246 | command.setLength(0); |
| 247 | } else if (trimmedLine.length() > 0) { |
| 248 | command.append(line); |
| 249 | command.append(LINE_SEPARATOR); |
| 250 | } |
| 251 | return command; |
| 252 | } |
| 253 | |
| 254 | private boolean lineIsComment(String trimmedLine) { |
| 255 | return trimmedLine.startsWith("//") || trimmedLine.startsWith("--"); |
no test coverage detected