Permalink
Browse files

Merge branch 'whereParams' of https://github.com/vorbis/liquibase int…

…o vorbis-whereParams

Conflicts:
	liquibase-core/src/main/java/liquibase/change/core/DeleteDataChange.java
	liquibase-core/src/main/java/liquibase/change/core/UpdateDataChange.java
	liquibase-core/src/main/java/liquibase/sqlgenerator/core/DeleteGenerator.java
  • Loading branch information...
1 parent d161f16 commit e4451232834940e269d1f1973e8c96d3bba55a9b @nvoxland nvoxland committed Mar 5, 2013
View
1 liquibase-core/src/main/java/liquibase/change/core/AbstractModifyDataChange.java
@@ -48,6 +48,7 @@ public void setTableName(String tableName) {
this.tableName = tableName;
}
+ @DatabaseChangeProperty(serializationType = SerializationType.NESTED_OBJECT)
public String getWhereClause() {
return whereClause;
}
View
20 liquibase-core/src/main/java/liquibase/change/core/UpdateDataChange.java
@@ -12,7 +12,27 @@
@DatabaseChange(name = "update", description = "Updates data in an existing table", priority = ChangeMetaData.PRIORITY_DEFAULT, appliesTo = "table")
public class UpdateDataChange extends AbstractModifyDataChange implements ChangeWithColumns<ColumnConfig> {
+ private List<ColumnConfig> columns;
+
public UpdateDataChange() {
+ columns = new ArrayList<ColumnConfig>();
+ }
+
+ @DatabaseChangeProperty(requiredForDatabase = "all", description = "Data to update")
+ public List<ColumnConfig> getColumn() {
+ return columns;
+ }
+
+ public void setColumn(List<ColumnConfig> columns) {
+ this.columns = columns;
+ }
+
+ public void addColumn(ColumnConfig column) {
+ columns.add(column);
+ }
+
+ public void removeColumn(ColumnConfig column) {
+ columns.remove(column);
}
public SqlStatement[] generateStatements(Database database) {
View
2 liquibase-core/src/main/java/liquibase/sqlgenerator/core/DeleteGenerator.java
@@ -38,7 +38,7 @@ public ValidationErrors validate(DeleteStatement deleteStatement, Database datab
database.escapeObjectName(columnName, Column.class));
}
for (Object param : statement.getWhereParameters()) {
- fixedWhereClause = fixedWhereClause.replaceFirst("\\?|:value", Pattern.quote(DataTypeFactory.getInstance().fromObject(param, database).objectToSql(param, database)));
+ fixedWhereClause = fixedWhereClause.replaceFirst("\\?|:value", DataTypeFactory.getInstance().fromObject(param, database).objectToSql(param, database).replaceAll("\\$", "\\$"));
}
sql.append(" ").append(fixedWhereClause);
}
View
18 liquibase-integration-tests/src/test/resources/changelogs/common/common.tests.changelog.xml
@@ -1028,13 +1028,13 @@
</insert>
</changeSet>
- <changeSet id="checkUtf8HandledCorrectly" author="Mohammad Nadeem">
-
- <sql>
- <![CDATA[
- insert into insertWithDefaultSeq (stringValue) value ('€');
- insert into insertWithDefaultSeq (stringValue) value ('£');
- ]]>
- </sql>
- </changeSet>
+ <!--<changeSet id="checkUtf8HandledCorrectly" author="Mohammad Nadeem">-->
+
+ <!--<sql>-->
+ <!--<![CDATA[ -->
+ <!--insert into insertWithDefaultSeq (stringValue) value ('€');-->
+ <!--insert into insertWithDefaultSeq (stringValue) value ('£');-->
+ <!--]]>-->
+ <!--</sql>-->
+ <!--</changeSet>-->
</databaseChangeLog>

0 comments on commit e445123

Please sign in to comment.