Page 1 of 1

Using Multiple TMyLoader Components

Posted: Fri 04 Feb 2011 04:27
by siik
Hi,

I need to bulk insert date into two tables. I have tried using two tMyLoader components, however the second one always fails.

Procedure:

loop through data, use Loader1.PutColumnData();
Loader1.Load;
Loop through second data, use Loader2.PutColumnData();
Loader2.Load; << this statement doesnt do anything

If i use manual insert statements on the second load this procedure works.
Help appreciated.

Posted: Fri 04 Feb 2011 15:38
by AndreyZ
Hello,

I cannot reproduce the problem. I have executed the following code:

Code: Select all

procedure TMainForm.BitBtnClick(Sender: TObject);
begin
  MyLoader1.Connection := MyConnection;
  MyLoader1.TableName := 'test_load1';
  MyLoader1.Load;
  MyLoader2.Connection := MyConnection;
  MyLoader2.TableName := 'test_load2';
  MyLoader2.Load;
end;

procedure TMainForm.MyLoader1PutData(Sender: TDALoader);
var
  i: integer;
begin
  for i := 1 to 50 do begin
    Sender.PutColumnData(0, i, i);
    Sender.PutColumnData(1, i, 'test');
    Sender.PutColumnData(2, i, i);
  end;
end;

procedure TMainForm.MyLoader2PutData(Sender: TDALoader);
var
  i: integer;
begin
  for i := 1 to 50 do begin
    Sender.PutColumnData(0, i, i);
    Sender.PutColumnData(1, i, i);
    Sender.PutColumnData(2, i, 'test');
  end;
end;
Both tables were filled with data. Please try using this code and check if the problem persists. If the problem isn't solved, please specify the following:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can see it in the Info sheet of TMyConnection Editor.