[OT [OT]] - assering database query results

Nicholas Clark nick at ccl4.org
Thu Sep 17 13:34:56 BST 2009


Off topicly off topic, as it's not even about that 4 letter P word.

So, we have quite a lot of our database queries in config files, with
placeholders, etc

Some of them are only supposed to return 1 row.
However, if our assumptions are wrong, they might return multiple rows.
This isn't a fatal bug in our code, which is written such that it takes the
first row returned. However, it is a bug in our logic.

Is there a good way to "assert" that there is only one row? So that in the
development (and QA) environments, it is fatal to breach assumptions.
But production keeps going.

Nicholas Clark


More information about the london.pm mailing list