[thelist] sql filtering problem

Joshua Olson joshua at waetech.com
Tue Aug 27 09:09:01 CDT 2002


----- Original Message -----
From: "darren" <darren at web-bitch.co.uk>
Sent: Tuesday, August 27, 2002 9:41 AM


> i'd re-write the sql generation part so that the parameters aren't passed
> in if you don't have values for them.  this is a simple way of having one
> sql string get all the values or filtering the list as required.

Darren,

I agree with you 100%.  It is best to simply not include the conditions in
the WHERE clause if they are technically non-consequential.  However,
generating the SQL string become more difficult when dealing with the
no-conditions case.  A common technique is to start off the WHERE clause
with 1 = 1 so that every condition can be preceded with "AND" without worry.
I was trying to avoid that level of complexity.

:-)

-joshua




More information about the thelist mailing list