提交 32bab95c 编写于 作者: S Serge Rider

#7725 CSV import: source columns order fix (+debugging)


Former-commit-id: bbfab2f5
上级 408797d2
......@@ -238,6 +238,6 @@ public class DatabaseMappingAttribute implements DatabaseMappingObject {
@Override
public String toString() {
return DBUtils.getObjectFullName(source, DBPEvaluationContext.UI);
return source.getName();
}
}
......@@ -90,6 +90,11 @@ public class DatabaseTransferConsumer implements IDataTransferConsumer<DatabaseC
private ColumnMapping(DBDAttributeBinding sourceAttr) {
this.sourceAttr = sourceAttr;
}
@Override
public String toString() {
return sourceAttr + "->" + targetAttr;
}
}
public DatabaseTransferConsumer() {
......
......@@ -46,8 +46,11 @@ public class StreamTransferResultSet implements DBCResultSet {
private final DBCStatement statement;
private StreamProducerSettings.EntityMapping entityMapping;
private List<DBCAttributeMetaData> metaAttrs;
// Stream row: values in source attributes order
private Object[] streamRow;
private final List<StreamProducerSettings.AttributeMapping> attributeMappings;
// Maps target attributes indexes to source attributes indexes
// (not indexes in source data, it is controlled by AttributeMapping.sourceAttributeIndex)
private final int[] targetToSourceMap;
private DateTimeFormatter dateTimeFormat;
......@@ -91,7 +94,7 @@ public class StreamTransferResultSet implements DBCResultSet {
return attr.getDefaultValue();
}
Object value = streamRow[sourceIndex];
Object value = streamRow[attr.getSourceAttributeIndex()];
if (value != null && dateTimeFormat != null && attr.getTargetAttribute() != null && attr.getTargetAttribute().getDataKind() == DBPDataKind.DATETIME) {
// Convert string to timestamp
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册