How TMyQuery works
Posted: Sun  21 Aug 2016 04:09
				
				Hi, conside the following code:
Does it fetch the full result from the MySQL server when I open the xQ? Or it keeps fetching when it executes xQ.Next?
If it fetches the full result to the client machine, then why I can't close the mySQL connection immediately xQ.Open?
If it fatches iteratively, is there any way that I get the full result together in client machine and itereate it there? My target is to reduce number of communication with the server.
Thanks in advance for your help.
			Code: Select all
procedure Query2();
var
  xQ : TMyQuery;
  ResultString, ss : string;
begin
    xQ := TMyQuery.Create(nil);
    xQ.Connection := Form1.MySQL1Connection;
    xQ.SQL.Clear;
    xQ.SQL.Add('SELECT   a, b, c from table) 
    xQ.Open;
    while not xQ.Eof do
    begin
       ResultString := ResultString + ' A ' + inttostr(xQ.FieldValues['a']);
       xQ.Next;
    end;
    xQ.Close;
    xQ.Free;
end;If it fetches the full result to the client machine, then why I can't close the mySQL connection immediately xQ.Open?
If it fatches iteratively, is there any way that I get the full result together in client machine and itereate it there? My target is to reduce number of communication with the server.
Thanks in advance for your help.