[OT [OT]] - assering database query results
ian.knopke at gmail.com
Thu Sep 17 14:08:49 BST 2009
Would something like this work?
my $query='select * from table';
$query .= ' limit 1' if $stilltesting;
On Thu, Sep 17, 2009 at 1:34 PM, Nicholas Clark <nick at ccl4.org> wrote:
> 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