Subject | Re: [firebird-support] Custom search string |
---|---|
Author | Walter Ogston |
Post date | 2005-05-03T13:31:41Z |
Grant,
Not being much of an expert I hesitate to offer comments, and I have lost
your original post, but perhaps what you want is static parameterized SQL
that looks like this:
...
where
(Text1 = :T1 or :T1 = 'xxxx' ) and
(Text2 = :T2 or :T2 = 'xxxx') and
...
I am assuming a fixed set of edits each corresponding to its own table
column. The string 'xxxx' has to be something that never occurs in the
column, standing in for a null parameter. In client code, you just need to
set the parameter value to 'xxxx' when the corresponding edit is empty,
and that column will not be used in the restriction. Before executing the
query, you would probably want to check that at least one of the edits has
text in it, otherwise you would select all rows in the able.
hth
Walter
At 09:31 AM 5/2/2005, you wrote:
C. Walter Ogston
ogstoncw@...
*/
Not being much of an expert I hesitate to offer comments, and I have lost
your original post, but perhaps what you want is static parameterized SQL
that looks like this:
...
where
(Text1 = :T1 or :T1 = 'xxxx' ) and
(Text2 = :T2 or :T2 = 'xxxx') and
...
I am assuming a fixed set of edits each corresponding to its own table
column. The string 'xxxx' has to be something that never occurs in the
column, standing in for a null parameter. In client code, you just need to
set the parameter value to 'xxxx' when the corresponding edit is empty,
and that column will not be used in the restriction. Before executing the
query, you would probably want to check that at least one of the edits has
text in it, otherwise you would select all rows in the able.
hth
Walter
At 09:31 AM 5/2/2005, you wrote:
>Hi Tim,/*
>
> >> I think you are really looking for is full blown case logic where
>parts of the statement can be included depending on some input.
>
>Which is exactly what I am after.
>
> >> ABC.SQL.Add('where Detect= :123);
> >> if X = true then ABC.SQL.Add('and Text1= :T1);
> >> if C = true then ABC.SQL.Add('and Text2= :T2);
>
>Hence the "if X = true then ABC.SQL.ADD(...." with the ".ADD" part being
>the important bit.
>
>But anyway thanks for your help Tim. Given the bad raps I have read
>about the Execute Statement a dynamic query at the client side may be
>the way to go, however Ali has suggested a way to go so I will try that
>first.
>
>Again thanks for your help.
>
>--
>Regards,
>Grant Brown
>
>Product Development Manager
>Phone : 02 4229 1185
>Mobile : 0412 926 995
>Email : grant@...
>Web : www.sitedoc.com.au
>
>SiteDoc - Easy to Use - Powerful Results
>
>
>
>Visit <http://firebird.sourceforge.net>http://firebird.sourceforge.net and
>click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at
><http://www.ibphoenix.com>http://www.ibphoenix.com
>
>
>
>----------
>Yahoo! Groups Links
> * To visit your group on the web, go to:
> *
> <http://groups.yahoo.com/group/firebird-support/>http://groups.yahoo.com/group/firebird-support/
>
> *
> * To unsubscribe from this group, send an email to:
> *
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>firebird-support-unsubscribe@yahoogroups.com
>
> *
> * Your use of Yahoo! Groups is subject to the
> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
C. Walter Ogston
ogstoncw@...
*/