Refactoring, cleanup, lose unnecessary resultset/cursor objects
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI.pm
index 13b7cc0..453d51c 100644 (file)
@@ -123,6 +123,16 @@ sub select {
   return $self->cursor->new($sth, \@bind, $attrs);
 }
 
+sub select_single {
+  my ($self, $ident, $select, $condition, $attrs) = @_;
+  my $order = $attrs->{order_by};
+  if (ref $condition eq 'SCALAR') {
+    $order = $1 if $$condition =~ s/ORDER BY (.*)$//i;
+  }
+  my ($rv, $sth, @bind) = $self->_execute('select', $attrs->{bind}, $ident, $select, $condition, $order);
+  return $sth->fetchrow_array;
+}
+
 sub sth {
   shift->dbh->prepare(@_);
 }