Skip to content

Commit

Permalink
Fixed flyway#2029: Regression in 5.1.0 regarding non-transactional mi…
Browse files Browse the repository at this point in the history
…grations including comments
  • Loading branch information
Axel Fontaine committed May 28, 2018
1 parent 7938871 commit afd3229
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter)
currentDelimiter = delimiter;
}

if (StringUtils.countOccurrencesOf(statementStart, " ") < 4) {
if (hasNonCommentPart() && StringUtils.countOccurrencesOf(statementStart, " ") < 4) {
statementStart += line;
statementStart += " ";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected void applyStateChanges(String line) {

super.applyStateChanges(line);

if (!executeInTransaction) {
if (!executeInTransaction || !hasNonCommentPart()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class RedshiftSqlStatementBuilder extends SqlStatementBuilder {
protected void applyStateChanges(String line) {
super.applyStateChanges(line);

if (!executeInTransaction) {
if (!executeInTransaction || !hasNonCommentPart()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ protected String cleanToken(String token) {

@Override
protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter) {

// need only accumulate 16 characters of normalized statement start in order to determine if it is an 'interesting' statement
if (statementStartNormalized.length() < 16) {
if (hasNonCommentPart() && statementStartNormalized.length() < 16) {
final String effectiveLine = cutCommentsFromEnd(line);
statementStartNormalized += effectiveLine + " ";
statementStartNormalized = StringUtils.trimLeadingWhitespace(StringUtils.collapseWhitespace(statementStartNormalized));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class SQLiteSqlStatementBuilder extends SqlStatementBuilder {

@Override
protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter) {
if (StringUtils.countOccurrencesOf(statementStart, " ") < 8) {
if (hasNonCommentPart() && StringUtils.countOccurrencesOf(statementStart, " ") < 8) {
statementStart += line;
statementStart += " ";
statementStart = StringUtils.collapseWhitespace(statementStart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SQLServerSqlStatementBuilder(Delimiter defaultDelimiter) {
protected void applyStateChanges(String line) {
super.applyStateChanges(line);

if (!executeInTransaction) {
if (!executeInTransaction || !hasNonCommentPart()) {
return;
}

Expand Down

0 comments on commit afd3229

Please sign in to comment.