From: Matt S Trout Date: Sat, 6 Aug 2005 19:54:38 +0000 (+0000) Subject: retrieve_from_sql now uses ->search X-Git-Tag: v0.03001~67 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8da9889b05116ab72ca230c72f8e2845ff0783b0;p=dbsrgits%2FDBIx-Class.git retrieve_from_sql now uses ->search --- diff --git a/lib/DBIx/Class/Table.pm b/lib/DBIx/Class/Table.pm index 0123aef..d3c737f 100644 --- a/lib/DBIx/Class/Table.pm +++ b/lib/DBIx/Class/Table.pm @@ -258,10 +258,9 @@ sub add_columns { sub retrieve_from_sql { my ($class, $cond, @vals) = @_; $cond =~ s/^\s*WHERE//i; - my $attrs = (ref $vals[$#vals] eq 'HASH' ? pop(@vals) : {}); - my @cols = $class->_select_columns($attrs); - #warn "@cols $cond @vals"; - return $class->cursor_to_resultset(undef, \@vals, \@cols, { where => \$cond, %$attrs }); + my $attrs = (ref $vals[$#vals] eq 'HASH' ? { %{ pop(@vals) } } : {}); + $attrs->{bind} = \@vals; + return $class->search(\$cond, $attrs); } =item count_from_sql @@ -327,7 +326,7 @@ sub search { if (@_ > 1 && ref $_[$#_] eq 'HASH') { $attrs = { %{ pop(@_) } }; } - my $query = ref $_[0] eq "HASH" ? shift: {@_}; + my $query = (@_ == 1 || ref $_[0] eq "HASH" ? shift: {@_}); my @cols = $class->_select_columns; return $class->cursor_to_resultset(undef, $attrs->{bind}, \@cols, { where => $query, %$attrs });