Skip to content
Permalink
Browse files

0003624: Some situations can cause a transformed value to be written to

the old column value instead of the new column value.
  • Loading branch information...
chenson42 committed Jul 13, 2018
1 parent 93b32b5 commit 2557e3a6d5a00a6e532961b5609890ca070531c6
Showing with 33 additions and 33 deletions.
  1. +33 −33 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/TransformWriter.java
@@ -262,39 +262,7 @@ protected boolean perform(DataContext context, TransformedData data,
boolean persistData = false;
try {

TargetDmlAction targetAction = null;
switch (data.getTargetDmlType()) {
case INSERT:
targetAction = TargetDmlAction.INS_ROW;
break;
case UPDATE:
targetAction = transformation.evaluateTargetDmlAction(context, data);
break;
case DELETE:
targetAction = transformation.getDeleteAction();
break;
default:
persistData = true;
}
if (targetAction != null) {
// how to handle the update/delete action on target..
switch (targetAction) {
case DEL_ROW:
data.setTargetDmlType(DataEventType.DELETE);
break;
case UPDATE_COL:
case UPD_ROW:
data.setTargetDmlType(DataEventType.UPDATE);
break;
case INS_ROW:
data.setTargetDmlType(DataEventType.INSERT);

break;
case NONE:
default:
break;
}
}


DataEventType eventType = data.getSourceDmlType();
for (TransformColumn transformColumn : transformation.getTransformColumns()) {
@@ -343,6 +311,7 @@ protected boolean perform(DataContext context, TransformedData data,
}
}

TargetDmlAction targetAction = data.getTargetAction();
if (targetAction != null && data.getColumnNames().length > 0 && targetAction != TargetDmlAction.NONE) {
persistData = true;
} else {
@@ -378,6 +347,37 @@ protected boolean perform(DataContext context, TransformedData data,
sourceKeyValues, oldSourceValues, sourceValues);
datas.add(data);
DataEventType eventType = data.getSourceDmlType();

switch (data.getTargetDmlType()) {
case INSERT:
data.setTargetAction(TargetDmlAction.INS_ROW);
break;
case UPDATE:
data.setTargetAction(transformation.evaluateTargetDmlAction(context, data));
break;
case DELETE:
data.setTargetAction(transformation.getDeleteAction());
break;
default:
data.setTargetAction(TargetDmlAction.OTHER);
}
// how to handle the update/delete action on target..
switch (data.getTargetAction()) {
case DEL_ROW:
data.setTargetDmlType(DataEventType.DELETE);
break;
case UPDATE_COL:
case UPD_ROW:
data.setTargetDmlType(DataEventType.UPDATE);
break;
case INS_ROW:
data.setTargetDmlType(DataEventType.INSERT);
break;
case NONE:
default:
break;
}

for (TransformColumn transformColumn : columns) {
IncludeOnType includeOn = transformColumn.getIncludeOn();
if (includeOn == IncludeOnType.ALL

0 comments on commit 2557e3a

Please sign in to comment.
You can’t perform that action at this time.