Because the internet connection to the MySQL server is slow, I set FetchAll to False and FetchRows to 25 to speed up data presentation to the user. Unfortunately, it does not work. The application always seems to load ALL data into the DBGrid rather than multiple chunks of 25 each on demand, no matter what I do to FetchAll and FetchRows. Using a TMySQLMonitor, I see only one query being executed (don't know though if multiple should be seen in FetchAll=False mode).
Am I missing the obvious here?
Many thanks
Lu
FetchAll and FetchRows, no effect
-
AndreyZ
Re: FetchAll and FetchRows, no effect
Hello,
Please try using the following code:, ahd check that the ShowMessage procedure shows that TMyQuery fetched only 25 records.
Please change this code to demonstrate the problem when TMyQuery fetches all records at once.
Please try using the following code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
con: TMyConnection;
q: TMyQuery;
begin
con := TMyConnection.Create(nil);
q := TMyQuery.Create(nil);
try
con.Server := 'server';
con.Port := 3306;
con.Username := 'username';
con.Password := 'password';
con.Database := 'database';
con.LoginPrompt := False;
q.Connection := con;
q.FetchAll := False;
q.FetchRows := 25;
q.SQL.Text := 'select * from bigtable';
q.Open;
ShowMessage(IntToStr(q.RecordCount)); // must show 25
finally
q.Free;
con.Free;
end;
end;Please change this code to demonstrate the problem when TMyQuery fetches all records at once.