On Jul 23, 2014, at 6:34 PM, Brandon Bloom <brandon.d.bl...@gmail.com> wrote: > SELECT ... main query stuff WHERE basic conditions > AND (? OR dateUpdated >= ? AND dateUpdated < ? > AND (? OR someColumn = ?) > ... > (query db basic params (boolean date-range) (or date-range (now)) (or > date-range (now)) (boolean qualifier) (or qualifier ""))
I think you mean (not date-range) and (not qualifier)? Otherwise you'll have (true OR ...) if the params are present... But that's a very neat trick! I ran it past our DBA and he verified that the execution plan definitely short-circuits the booleans with true / false (which was my initial concern after being somewhat gunshy of 'OR' in queries due to performance problems that has caused in complex queries). Thank you Brandon! Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880)
signature.asc
Description: Message signed with OpenPGP using GPGMail