[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] Help with optional parameters
From:       MaXX <bs139412 () skynet ! be>
Date:       2006-09-21 22:48:14
Message-ID: eev4rk$2l3h$1 () talisker ! lacave ! net
[Download RAW message or body]

Curtis Scheer wrote:
 > I noticed this one by searching in the archives, as I am working with 
some
 > "optional" parameters myself and noticed your solution. I just wanted to
 > make one improvement suggestion which is instead of checking whether 
or not
 > a parameter has been used simply start your query like so
 > Query_base := 'SELECT * FROM my_table WHERE 1 =1;
 > If you do that then you can just add on any parameters you need or 
not add
 > any at all. I think that seems to be a bit simpler than having a 
has_param"
 > Boolean variable.
True, I think I was too focused on the "clean" output, your solution 
wastes less cycles and is more readable...

Snipet updated,

Thanks,
--
MaXX

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic