Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

JIRA CORE-908: use explicit jdbcTemplate in DropAllForeignKeyConstrai…

…nts.generateChildren() to ensure SQL to locate foreign keys executes in updateSQL mode

git-svn-id: http://liquibase.jira.com/svn/CORE/branches/1_9@2056 e6edf6fb-f266-4316-afb4-e53d95876a76
  • Loading branch information...
commit 730d219df4136cf8a829ba3ee4fe20c1ad1d41da 1 parent a5afd42
donsmith authored
3  core/src/java/liquibase/change/DropAllForeignKeyConstraintsChange.java
View
@@ -98,7 +98,8 @@ private void generateChildren(Database database) throws UnsupportedChangeExcepti
// Make a new list
childDropChanges = new ArrayList<DropForeignKeyConstraintChange>();
- JdbcTemplate jdbc = database.getJdbcTemplate();
+ // JIRA CORE-908: use explicit jdbcTemplate here to avoid use of jdbcOutputTemplate in updateSQL mode
+ JdbcTemplate jdbc = new JdbcTemplate(database);
FindForeignKeyConstraintsStatement sql = new FindForeignKeyConstraintsStatement(
getBaseTableSchemaName(),
10 core/src/java/liquibase/database/sql/FindForeignKeyConstraintsStatement.java
View
@@ -89,13 +89,13 @@ public String getSqlStatement(Database database) throws StatementNotSupportedOnD
sb.append("AND RC.CONSTRAINT_NAME = KCU.CONSTRAINT_NAME ");
sb.append("AND RC.TABLE_NAME = '").append(getBaseTableName()).append("' ");
try {
- sb.append("AND RC.CONSTRAINT_SCHEMA = '").append(database.convertRequestedSchemaToSchema(null)).append("'");
+ sb.append("AND RC.CONSTRAINT_SCHEMA = '").append(database.convertRequestedSchemaToSchema(null)).append("' ");
} catch (liquibase.exception.JDBCException e) {
StatementNotSupportedOnDatabaseException se = new StatementNotSupportedOnDatabaseException(this, database);
se.initCause(e);
throw se;
}
- sb.append("LIMIT 1");
+ sb.append("LIMIT 1 ");
return sb.toString();
}
@@ -119,13 +119,13 @@ public String getSqlStatement(Database database) throws StatementNotSupportedOnD
sb.append("AND BASE.TABLE_NAME = '").append(getBaseTableName()).append("' ");
sb.append("AND BASE.CONSTRAINT_TYPE = 'R' ");
try {
- sb.append("AND BASE.OWNER = '").append(database.convertRequestedSchemaToSchema(null)).append("'");
+ sb.append("AND BASE.OWNER = '").append(database.convertRequestedSchemaToSchema(null)).append("' ");
} catch (liquibase.exception.JDBCException e) {
StatementNotSupportedOnDatabaseException se = new StatementNotSupportedOnDatabaseException(this, database);
se.initCause(e);
throw se;
}
- sb.append("AND ROWNUM <= 1");
+ sb.append("AND ROWNUM <= 1 ");
return sb.toString();
}
@@ -146,7 +146,7 @@ public String getSqlStatement(Database database) throws StatementNotSupportedOnD
sb.append(" INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2 ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME ");
sb.append(" WHERE i1.CONSTRAINT_TYPE = 'PRIMARY KEY' ");
sb.append(") PT ON PT.TABLE_NAME = PK.TABLE_NAME ");
- sb.append("WHERE FK.TABLE_NAME='").append(getBaseTableName()).append("'");
+ sb.append("WHERE FK.TABLE_NAME='").append(getBaseTableName()).append("' ");
return sb.toString();
}
Please sign in to comment.
Something went wrong with that request. Please try again.