FireDAC TFDBatchMove custom Mappings ..

FireDAC TFDBatchMove custom Mappings ..

Has anyone have a sample of creating custom mappings for moving data using TFDBatchMove with a TFDBatchMoveSQLReader and TFDBatchMoveSQLWriter?

I get an error: 'access violation at .. :read of address ..'
I wrote ..

var
  I: Integer;
  ABatchMoveMappingItem: TFDBatchMoveMappingItem;
begin
    fdbatchmove.Mappings.Clear;
    fdmetaSource.First;
    fdmetaTarget.First;
    while NOT fdmetaSource.Eof do
    begin
      ABatchMoveMappingItem := fdbatchmove.Mappings.Add;
      ABatchMoveMappingItem.SourceFieldName := fdmetaSource.FieldByName('COLUMN_NAME').AsString;
      ABatchMoveMappingItem.DestinationFieldName := fdmetaTarget.FieldByName('COLUMN_NAME').AsString;
      fdmetaSource.Next;
      fdmetaTarget.Next;
    end;

    fdbatchmove.Execute;
  end;

Comments

  1. Johan Swart Do you get the AV consistently, while debugging? If so, does the call stack shed any light on where it goes wrong?

    ReplyDelete
  2. I'm getting the error consistently.

    I've never used the call stack before. I did switch on the tracing on FireDAC, but so far I have not found anything yet.
    Perhaps, can someone set up a simple example of moving data between two tables with different column names.
    I suspect I'm doing something wrong, but I am not a fulltime Delphi developer, just a hobbyist, so I am a bit lost :)

    ReplyDelete
  3. Hi all,

    Just to give some update. I recreated the TFDBatchMove custom mapping test application using Interbase as both source and target and it worked fine!
    That means the problem is more specific to my target (DB2) . I have a MS SQL Server Source and a DB2 target.

    ReplyDelete

Post a Comment