@Test public void shouldAcceptMultiCharDelimiter() throws Exception { Connection conn = mock(Connection.class); Statement stmt = mock(Statement.class); when(conn.createStatement()).thenReturn(stmt); when(stmt.getUpdateCount()).thenReturn(-1); ScriptRunner runner = new ScriptRunner(conn); String sql = "-- @DELIMITER || \n" + "line 1;\n" + "line 2;\n" + "||\n" + " + "line 3; \n"; Reader reader = new StringReader(sql); runner.runScript(reader); verify(stmt, Mockito.times(1)).execute(eq("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR)); verify(stmt, Mockito.times(1)).execute(eq("line 3" + LINE_SEPARATOR)); }
public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } }
ScriptRunner { public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } } }
ScriptRunner { public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } } ScriptRunner(Connection connection); }
ScriptRunner { public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } } ScriptRunner(Connection connection); void setStopOnError(boolean stopOnError); void setThrowWarning(boolean throwWarning); void setAutoCommit(boolean autoCommit); void setSendFullScript(boolean sendFullScript); void setRemoveCRs(boolean removeCRs); void setEscapeProcessing(boolean escapeProcessing); void setLogWriter(PrintWriter logWriter); void setErrorLogWriter(PrintWriter errorLogWriter); void setDelimiter(String delimiter); void setFullLineDelimiter(boolean fullLineDelimiter); void runScript(Reader reader); void closeConnection(); }
ScriptRunner { public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } } ScriptRunner(Connection connection); void setStopOnError(boolean stopOnError); void setThrowWarning(boolean throwWarning); void setAutoCommit(boolean autoCommit); void setSendFullScript(boolean sendFullScript); void setRemoveCRs(boolean removeCRs); void setEscapeProcessing(boolean escapeProcessing); void setLogWriter(PrintWriter logWriter); void setErrorLogWriter(PrintWriter errorLogWriter); void setDelimiter(String delimiter); void setFullLineDelimiter(boolean fullLineDelimiter); void runScript(Reader reader); void closeConnection();  }