Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-01

Problem with TSQLQuery

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Volker Zipfel

Hi all,

i've got a problem while reading a huge database table with TSQLQuery. The program consumes all the memory and is then terminated by the kernel. I think all read table rows are buffered. Is there a way to disable or limit the size of the buffer?

Example:
  FQuery.SQL.Add('select * from TEST');
  FQuery.Open;
  while not FQuery.EOF do begin
    s := FQuery.Fields[0].AsString;
    Inc(Count);
    FQuery.Next;
  end;
  FQuery.Close;

Reply by email

Henry Vermaak
to Volker Zipfel
Hi all,

hi there

Show quoted text 14 lines
i've got a problem while reading a huge database table with TSQLQuery. The program consumes all the memory and is then terminated by the kernel. I think all read table rows are buffered. Is there a way to disable or limit the size of the buffer? Example: FQuery.SQL.Add('select * from TEST'); FQuery.Open; while not FQuery.EOF do begin s := FQuery.Fields[0].AsString; Inc(Count); FQuery.Next; end; FQuery.Close;

doing a "select *" query is usually a bad idea for exactly the reason that you are describing. the whole point of sql is to limit the amount of data transferred between client and server and to try and do the computations on the server side, if possible.

what is it exactly that you want to accomplish? if you really need to get all the data, you'll probably have to use something like this:

select * from test
where index_field > last_fetched_index
limit 100

storing last_fetched_index every time.

henry

Reply by email