|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2008 the original author or authors. |
|
|
|
|
* Copyright 2002-2009 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -16,15 +16,15 @@
@@ -16,15 +16,15 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.test.jdbc; |
|
|
|
|
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
import java.io.LineNumberReader; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.LineNumberReader; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* JdbcTestUtils is a collection of JDBC related utility methods for |
|
|
|
|
* use in unit and integration testing scenarios. |
|
|
|
|
* JdbcTestUtils is a collection of JDBC related utility methods for use in unit |
|
|
|
|
* and integration testing scenarios. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Risberg |
|
|
|
|
* @since 2.5.4 |
|
|
|
@ -32,8 +32,11 @@ import java.io.IOException;
@@ -32,8 +32,11 @@ import java.io.IOException;
|
|
|
|
|
public class JdbcTestUtils { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Read a script from the LineNumberReader and build a String containing the lines. |
|
|
|
|
* @param lineNumberReader the <code>LineNumberReader</> containing the script to be processed |
|
|
|
|
* Read a script from the LineNumberReader and build a String containing the |
|
|
|
|
* lines. |
|
|
|
|
* |
|
|
|
|
* @param lineNumberReader the <code>LineNumberReader</code> containing the |
|
|
|
|
* script to be processed |
|
|
|
|
* @return <code>String</code> containing the script lines |
|
|
|
|
* @throws IOException |
|
|
|
|
*/ |
|
|
|
@ -54,8 +57,10 @@ public class JdbcTestUtils {
@@ -54,8 +57,10 @@ public class JdbcTestUtils {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Does the provided SQL script contain the specified delimiter? |
|
|
|
|
* |
|
|
|
|
* @param script the SQL script |
|
|
|
|
* @param delim charecter delimiting each statement - typically a ';' character |
|
|
|
|
* @param delim character delimiting each statement - typically a ';' |
|
|
|
|
* character |
|
|
|
|
*/ |
|
|
|
|
public static boolean containsSqlScriptDelimiters(String script, char delim) { |
|
|
|
|
boolean inLiteral = false; |
|
|
|
@ -72,10 +77,13 @@ public class JdbcTestUtils {
@@ -72,10 +77,13 @@ public class JdbcTestUtils {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Split an SQL script into separate statements delimited with the provided delimiter character. Each |
|
|
|
|
* individual statement will be added to the provided <code>List</code>. |
|
|
|
|
* Split an SQL script into separate statements delimited with the provided |
|
|
|
|
* delimiter character. Each individual statement will be added to the |
|
|
|
|
* provided <code>List</code>. |
|
|
|
|
* |
|
|
|
|
* @param script the SQL script |
|
|
|
|
* @param delim charecter delimiting each statement - typically a ';' character |
|
|
|
|
* @param delim character delimiting each statement - typically a ';' |
|
|
|
|
* character |
|
|
|
|
* @param statements the List that will contain the individual statements |
|
|
|
|
*/ |
|
|
|
|
public static void splitSqlScript(String script, char delim, List<String> statements) { |
|
|
|
|