/** * Read a script from the provided {@code LineNumberReader}, using * "{@code --}" as the comment prefix, and build a {@code String} containing * the lines. * @param lineNumberReader the {@code LineNumberReader} containing the script * to be processed * @return a {@code String} containing the script lines * @see #readScript(LineNumberReader, String) * @deprecated as of Spring 4.0.3, in favor of using * {@link org.springframework.jdbc.datasource.init.ScriptUtils#readScript(LineNumberReader, String, String)} */ @Deprecated public static String readScript(LineNumberReader lineNumberReader) throws IOException { return readScript(lineNumberReader, ScriptUtils.DEFAULT_COMMENT_PREFIX); }
public static void executeScript(Connection con, String script, boolean continueOnError) throws Exception { LineNumberReader in = new LineNumberReader(new StringReader( script )); List<String> statements = new LinkedList<>(); JdbcTestUtils.splitSqlScript(JdbcTestUtils.readScript(in), ';', statements); if (continueOnError){ con.setAutoCommit(true);