Subject Re: [firebird-support] Re: where field = any
Author Robert martin
Hi

Wouldn't the whole thing be easier to maintain if it was two SQL statements, one that is used for All results and the other that is a subset of the results?

It seems to me that someone else looking at the code could better understand what is going on if the statement was changed depending on the circumstance. After all the query needs to be re run every time you change the parameter anyway. I guess the only thing you gain by doing it as below (which I think is really clever) is that you wouldn't need to re prepare the SQL like you would with two SQL's.

Just my 2c


Rob Martin
Software Engineer

phone 03 377 0495
fax 03 377 0496
web www.chreos.com
Wild Software Ltd
----- Original Message -----
From: James
To: firebird-support@yahoogroups.com
Sent: Thursday, October 21, 2004 3:06 PM
Subject: Re: [firebird-support] Re: where field = any


Hi Miroslav,

You got a nice answer here, but concerning on what svein erling posted,
if I had 1=0 will this scan the whole table and slow down the whole thing?

Thanks


James

Miroslav Penchev wrote:

> On Tue, 19 Oct 2004 06:40:07 -0000, Svein Erling Tysvær
> <svein.erling.tysvaer@...> wrote:
>
> >
> >> What about this?
> >>
> >> WHERE 1=1 OR FieldA =:ANY
> >
> > 1=1 will always be true, so every record will be returned regardless
> > of whether FieldA = :ANY or not.
>
> The "real" statement is:
>
> WHERE 1=:ACTIVE_FILTER OR FieldA =:ANY
>
> where :ACTIVE_FILTER is 0 or 1.
>
> --
> Miroslav Penchev
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=129es1q1r/M=294855.5468653.6549235.3001176/D=groups/S=1705115386:HM/EXP=1098289574/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.html>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/firebird-support/
>
> * To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>


Yahoo! Groups Sponsor
ADVERTISEMENT





------------------------------------------------------------------------------
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]