Sign in Join

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

Mailing lists / fpc-pascal / 2013-02

Bufdataset TCustomBufDataset.InternalOpen; swallowing filter construction

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Reinier Olislagers

Hi list,

In sqldb bufdataset.pas, going through the code looking through the
comments, this code caught my eye (around line 1164):
procedure TCustomBufDataset.InternalOpen;
...
  // parse filter expression
  try
    ParseFilter(Filter);
  except
    // oops, a problem with parsing, clear filter for now
    on E: Exception do Filter := EmptyStr;
  end;

seems to swallow problems with parsing filter expressions.

Shouldn't the exception bubble up though so the user is notified? If the filter is not correct, e.g. showing all data instead of what the user wanted seems a bit weird..

Thanks,
Reinier

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 19 lines
Hi list, In sqldb bufdataset.pas, going through the code looking through the comments, this code caught my eye (around line 1164): procedure TCustomBufDataset.InternalOpen; ... // parse filter expression try ParseFilter(Filter); except // oops, a problem with parsing, clear filter for now on E: Exception do Filter := EmptyStr; end; seems to swallow problems with parsing filter expressions. Shouldn't the exception bubble up though so the user is notified? If the filter is not correct, e.g. showing all data instead of what the user wanted seems a bit weird..

I think it should indeed bubble up.

Michael.

Reply by email

Reinier Olislagers
to Michael Van Canneyt
Michael Van Canneyt wrote 22 lines
On Mon, 4 Feb 2013, Reinier Olislagers wrote: > Hi list, > > In sqldb bufdataset.pas, going through the code looking through the > comments, this code caught my eye (around line 1164): > procedure TCustomBufDataset.InternalOpen; > ... > // parse filter expression > try > ParseFilter(Filter); > except > // oops, a problem with parsing, clear filter for now > on E: Exception do Filter := EmptyStr; > end; > > seems to swallow problems with parsing filter expressions. > > Shouldn't the exception bubble up though so the user is notified? If the > filter is not correct, e.g. showing all data instead of what the user > wanted seems a bit weird.. I think it should indeed bubble up.

Applied in r23570
Removed the try..except entirely; the old Filter:=EmptyStr hardly helps with troubleshooting...

dbtestframework bufdataset test count remains same: N:156 E:40 F:11 I:0
Any tests with filter in the name work as before

Thanks,
Reinier

Reply by email