Subject | Re: [firebird-support] "All" parameter variable |
---|---|
Author | ibrahim bulut |
Post date | 2003-10-20T13:16:06Z |
Hi,
I am doing that with my style.
SQL= 'select * from mytable where mydate = :mydate or 'ALL' = :GETALL'
Button1.click;
==========
query1.close,
query1.params[0].value:=Null;
query1.params[1].value:=Null;
if All=True Then query1.parambyname('GETALL').value:='ALL'
Else query1.parambyname('mydate').asdate:=dateedit1.date;
query1.open;
if you pass 'ALL' to getall parameter, query fetches all the record.
ibrahim Bulut
Software/Database Developer
Republic Of Turkey
I am doing that with my style.
SQL= 'select * from mytable where mydate = :mydate or 'ALL' = :GETALL'
Button1.click;
==========
query1.close,
query1.params[0].value:=Null;
query1.params[1].value:=Null;
if All=True Then query1.parambyname('GETALL').value:='ALL'
Else query1.parambyname('mydate').asdate:=dateedit1.date;
query1.open;
if you pass 'ALL' to getall parameter, query fetches all the record.
ibrahim Bulut
Software/Database Developer
Republic Of Turkey
----- Original Message -----
From: "rodbracher" <rod@...>
To: <firebird-support@yahoogroups.com>
Sent: Monday, October 20, 2003 1:58 PM
Subject: [firebird-support] "All" parameter variable
> Hi
>
> If I had a query
> select * from mytable where mydate = :date
>
> There is often the case you want to consider all dates. This would
> essentially mean removing the where condition - but it would be
> easier to have the query "know" to ignore that parameter if some
> symbol is passed in.
>
> This is a rather simple case, but when you have many parameters -
> each one being an option to use or not - it is a pain building SQL in
> code to cater for all permutations.
>
> Is there such a thing ?
>
> FB 1.0.3
>
> Thanks
>
> Rod
>
>
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>