[Bast-commits] r5084 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Nov 9 15:35:30 GMT 2008
Author: ribasushi
Date: 2008-11-09 15:35:30 +0000 (Sun, 09 Nov 2008)
New Revision: 5084
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Fix detection of multiple rows being returned for single(): calling fetchrow_array in scalar context leads to indefined results (http://search.cpan.org/~timb/DBI/DBI.pm#fetchrow_array)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2008-11-09 15:29:34 UTC (rev 5083)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2008-11-09 15:35:30 UTC (rev 5084)
@@ -1406,7 +1406,8 @@
my $self = shift;
my ($rv, $sth, @bind) = $self->_select(@_);
my @row = $sth->fetchrow_array;
- if(@row && $sth->fetchrow_array) {
+ my @nextrow = $sth->fetchrow_array if @row;
+ if(@row && @nextrow) {
carp "Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single";
}
# Need to call finish() to work round broken DBDs
More information about the Bast-commits
mailing list