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.