MCPcopy Create free account
hub / github.com/diyhi/bbs / handleLine

Method handleLine

src/main/java/cms/utils/SqlScriptRunner.java:232–252  ·  view source on GitHub ↗
(StringBuilder command, String line)

Source from the content-addressed store, hash-verified

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("--");

Callers 1

executeLineByLineMethod · 0.95

Calls 5

lineIsCommentMethod · 0.95
printlnMethod · 0.95
commandReadyToExecuteMethod · 0.95
executeStatementMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected