dropped during the serial-autodetection rwrite
- Make sure ResultSetColumn does not depend on the (undefined)
return value of ->cursor->reset()
+ - Add single() to ResultSetColumn (same semantics as ResultSet)
- Make sure to turn off IDENTITY_INSERT after insert() on MSSQL
tables that needed it
- More informative exception on failing _resolve_relationship
+ - Fix unreported rollback exceptions in TxnScopeGuard
0.08111 2009-09-06 21:58:00 (UTC)
- The hashref to connection_info now accepts a 'dbh_maker'
return $row;
}
+=head2 single
+
+=over 4
+
+=item Arguments: none
+
+=item Return Value: $value
+
+=back
+
+Much like L<DBIx::Class::ResultSet/single> fetches one and only one column
+value using the cursor directly. If additional rows are present a warning
+is issued before discarding the cursor.
+
+=cut
+
+sub single {
+ my $self = shift;
+
+ my $attrs = $self->_resultset->_resolved_attrs;
+ my ($row) = $self->_resultset->result_source->storage->select_single(
+ $attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs
+ );
+
+ return $row;
+}
+
=head2 min
=over 4
use strict;
-use warnings;
+use warnings;
use Test::More;
+use Test::Warn;
use Test::Exception;
use lib qw(t/lib);
use DBICTest;
is($rs_year->first, 1999, "first okay");
+warnings_exist (sub {
+ is($rs_year->single, 1999, "single okay");
+}, qr/Query returned more than one row/, 'single warned');
+
# test +select/+as for single column
my $psrs = $schema->resultset('CD')->search({},
{