Subject | RE: FW: [IBO] Filter |
---|---|
Author | Jason Wharton |
Post date | 2007-10-04T03:46:30Z |
Here's the fix for this in the ExtractFilterClause() in IB_Parse.pas unit.
Its around line 6245:
...
var
tmpCnt: integer;
tmpPos: integer; // Add this variable
begin { ProcessItem }
AName := PluckFirstToken( AFilter, true, false );
// Add what's below here
tmpCol := nil;
if ( AFilter <> '' ) and ( AFilter[1] = '(' ) then
begin
tmpPos := getLitsRoundSafePos( ')', AFilter, 2 );
if tmpPos >= 0 then
begin
AName := AName + Copy( AFilter, 1, tmpPos );
System.Delete( AFilter, 1, tmpPos );
end;
end
else
// Add what's above here
tmpCol := BDataset.FindField( AName ); // Line indented
AOper := GetRelOps( AFilter );
AFilter := Trim( AFilter );
tmpNOT := false;
if AOper = '' then
begin
...
Please let me know if this resolves the problems you are confronting.
Also, just so you know, when I implemented the Filter capabilities it was
specifically to be compatible with the BDE filter syntax. What this means
is, your use of this property was not consistent with its documented
behavior.
What I have done constitutes a feature enhancement rather than a bug fix. I
know it worked before, but it was due to luck rather than my intentions.
Thanks,
Jason Wharton
Its around line 6245:
...
var
tmpCnt: integer;
tmpPos: integer; // Add this variable
begin { ProcessItem }
AName := PluckFirstToken( AFilter, true, false );
// Add what's below here
tmpCol := nil;
if ( AFilter <> '' ) and ( AFilter[1] = '(' ) then
begin
tmpPos := getLitsRoundSafePos( ')', AFilter, 2 );
if tmpPos >= 0 then
begin
AName := AName + Copy( AFilter, 1, tmpPos );
System.Delete( AFilter, 1, tmpPos );
end;
end
else
// Add what's above here
tmpCol := BDataset.FindField( AName ); // Line indented
AOper := GetRelOps( AFilter );
AFilter := Trim( AFilter );
tmpNOT := false;
if AOper = '' then
begin
...
Please let me know if this resolves the problems you are confronting.
Also, just so you know, when I implemented the Filter capabilities it was
specifically to be compatible with the BDE filter syntax. What this means
is, your use of this property was not consistent with its documented
behavior.
What I have done constitutes a feature enhancement rather than a bug fix. I
know it worked before, but it was due to luck rather than my intentions.
Thanks,
Jason Wharton
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of mayerherbert
> Sent: Friday, September 28, 2007 12:40 AM
> To: IBObjects@yahoogroups.com
> Subject: Re: FW: [IBO] Filter
>
>
> I can confirm this issue.
>
> We recently updated to 4.8 und have the same problem everywhere we use
> a filter with an upper(). But it also affect filters with
> max() or min().
> So Filters as: (UPPER(XX.CUSTOMER_NAME) LIKE 'HELEN%')
> appends the where clause: AND UPPER(XX.CUSTOMER_NAME) AND
> LIKE 'HELEN%'
>
> The ::SQL:: prefacing did the trick, but this is no good situation
> because it worked without any turnaround or knockout in 4.5.
>
> Would be great if you'll find some time to take a look into. greatly
> appreciate if it can fixed in a further version.
>
> rgds
>
>
> --- In IBObjects@yahoogroups.com, "Jason Wharton"
> <supportlist@...> wrote:
> >
> >
> >
> > -----Original Message-----
> > From: Jason L. Wharton [mailto:jwharton@...]
> > Sent: Wednesday, September 26, 2007 12:53 PM
> > To: IBObjects@yahoogroups.com
> > Subject: RE: [IBO] Filter
> >
> >
> > Preface the Filter with ::SQL:: and then it won't process it. It
> will just
> > pass it through as raw SQL to be appended to your WHERE clause.
> >
> > Jason
> >
> >
> > > -----Original Message-----
> > > From: IBObjects@yahoogroups.com
> > > [mailto:IBObjects@yahoogroups.com] On Behalf Of tgtecchio
> > > Sent: Wednesday, September 19, 2007 5:08 AM
> > > To: IBObjects@yahoogroups.com
> > > Subject: Re: [IBO] Filter
> > >
> > > Hi Helen, thanks for your reply!
> > >
> > > My sql statement is just like this:
> > >
> > > SELECT XX.ID, XX.STATE, XX.CUSTOMER_NAME
> > > FROM CUSTOMER_TABLE XX
> > > WHERE XX.STATE = 'CA'
> > >
> > > After this, I apply the filter. I put the parenthesis as
> > > you told me, but IBO parsed a wrong sql statement.
> > >
> > > My filter: (UPPER(XX.CUSTOMER_NAME) LIKE 'HELEN%')
> > >
> > > So, when I apply the filter, I got this sql:
> > >
> > > SELECT XX.ID, XX.STATE, XX.CUSTOMER_NAME
> > > FROM CUSTOMER_TABLE XX
> > > WHERE XX.STATE = 'CA'
> > > AND (UPPER(XX.CUSTOMER_NAME) AND LIKE 'HELEN%')
> > >
> > > What is wrong because there's an extra "and" in the middle.
> > > I think the whole problem is located at
> > > TIB_Dataset.ProcessSQLWhereStrings,
> > > but who knows?
> > >
> > >
> > >
> > >
> > > --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@> wrote:
> > > >
> > > > At 03:16 AM 19/09/2007, you wrote:
> > > > >Hi!
> > > > >
> > > > > Do someone know what's wrong with this filter expression?
> > > > >
> > > > > UPPER(CLIENT_NAME) LIKE 'JOHN%'
> > > > >
> > > > > IBO raises an error everytime asking for parenthesis... Very
> > > strange.
> > > > >
> > > > > My configuration: D7 + F1.5 + IBO4.8.7
> > > >
> > > > Missing from your posting is the SELECT statement to which
> > > this filter
> > > > is being appended. That actually matters...
> > > >
> > > > 1. Do you need to include a relation qualifier to
> > > CLIENT_NAME? (the
> > > > relation name or relation alias that is used for that
> table in your
> > > > SELECT statement).
> > > >
> > > > 2. Try putting parentheses right around the whole thing.
> > > Filters are
> > > > appended to any existing WHERE clause so it's possible
> the revised
> > > > WHERE clause needs to isolate the filter.
> > > >
> > > > 3. Put in a monitor dialog. It's an amazingly useful way
> > > to resolve
> > > > "weird", "strange", etc.
> > > >
> > > > Helen
> > > >
> > >
> > >
> > >
> > >
> > > ______________________________________________________________
> > > _____________
> > > IB Objects - direct, complete, custom connectivity to
> > > Firebird or InterBase
> > > without the need for BDE, ODBC or any other layer.
> > > ______________________________________________________________
> > > _____________
> > > http://www.ibobjects.com - your IBO community resource for
> > > Tech Info papers,
> > > keyword-searchable FAQ, community code contributions and more
> > > !
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
>
>
>
>
> ______________________________________________________________
> _____________
> IB Objects - direct, complete, custom connectivity to
> Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ______________________________________________________________
> _____________
> http://www.ibobjects.com - your IBO community resource for
> Tech Info papers,
> keyword-searchable FAQ, community code contributions and more
> !
> Yahoo! Groups Links
>
>
>