Skip to content

Commit

Permalink
Merge branch 'master' of github.com:liquibase/liquibase
Browse files Browse the repository at this point in the history
  • Loading branch information
nvoxland committed Jun 30, 2012
2 parents c009334 + 8731bc5 commit b292b6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -415,7 +415,7 @@ protected void printHelp(PrintStream stream) {
stream.println(" updateSQL Writes SQL to update database to current");
stream.println(" version to STDOUT");
stream.println(" updateCount <num> Applies next NUM changes to the database");
stream.println(" updateSQL <num> Writes SQL to apply next NUM changes");
stream.println(" updateCountSQL <num> Writes SQL to apply next NUM changes");
stream.println(" to the database");
stream.println(" rollback <tag> Rolls back the database to the the state is was");
stream.println(" when the tag was applied");
Expand Down
8 changes: 5 additions & 3 deletions liquibase-core/src/main/java/liquibase/util/StringUtils.java
Expand Up @@ -10,6 +10,9 @@
* Various utility methods for working with strings.
*/
public class StringUtils {
private static final Pattern commentPattern = Pattern.compile("/\\*.*?\\*/", Pattern.DOTALL);
private static final Pattern dashPattern = Pattern.compile("\\-\\-.*$", Pattern.MULTILINE);

public static String trimToEmpty(String string) {
if (string == null) {
return "";
Expand Down Expand Up @@ -78,9 +81,8 @@ public static String[] splitSQL(String multiLineSQL, String endDelimiter) {
* @return The String without the comments in
*/
public static String stripComments(String multiLineSQL) {
String strippedSingleLines = Pattern.compile("(.*?)\\s*\\-\\-.*\n").matcher(multiLineSQL).replaceAll("$1\n");
strippedSingleLines = Pattern.compile("(.*?)\\s*\\-\\-.*$").matcher(strippedSingleLines).replaceAll("$1\n");
return Pattern.compile("/\\*.*?\\*/", Pattern.DOTALL).matcher(strippedSingleLines).replaceAll("").trim();
String strippedDashDash = dashPattern.matcher(multiLineSQL).replaceAll("");
return commentPattern.matcher(strippedDashDash).replaceAll("").trim();
}

public static String join(String[] array, String delimiter) {
Expand Down

0 comments on commit b292b6f

Please sign in to comment.