Mark Derricutt's Disturbing Thoughts

Evil generated SQL

posted Wednesday, 17 December 2003
Eh gads, just found the following evil SQL littered through my project, that darn Low Road code generator bites me again:
update filter_rules set rule_status =
  (case rule_status when 0 then 1 when 1 then 0 end)
  where rule_type=1 and filter_rule_id= ?
Problem arose when a record somehow got a null status, and was failing to toggle. Yuck. Time to refactor that evilness away.

links: digg this    del.icio.us    technorati    reddit