Public static void buffer2buffer(Common _source, Common _target)
{
TableScope scope = TableScope::CurrentTableOnly;
DictTable sourceDictTable = new DictTable(_source.TableId);
DictTable targetDictTable = new DictTable(_target.TableId);
FieldId sourceFieldId =
sourceDictTable.fieldNext(0, scope);
FieldId targetFieldId =
targetDictTable.fieldNext(0, scope);
Map
targetFields = new Map(Types::String, Types::Int64);
while (targetFieldId && ! isSysId(targetFieldId))
{
targetFields.insert(targetDictTable.fieldName(targetFieldId),
targetFieldId);
targetFieldId =
targetDictTable.fieldNext(targetFieldId, scope);
}
while (sourceFieldId && ! isSysId(sourceFieldId))
{
if
(targetFields.exists(sourceDictTable.fieldName(sourceFieldId)))
{
targetFieldId = targetFields.lookup(sourceDictTable.fieldName(sourceFieldId));
_target.(targetFieldId) =
_source.(sourceFieldId);
}
sourceFieldId =
sourceDictTable.fieldNext(sourceFieldId, scope);
}
}
No comments:
Post a Comment