From: Peter Rabbitson Date: Tue, 9 Jun 2009 23:27:19 +0000 (+0000) Subject: Think before commit X-Git-Tag: v0.08106~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f4832aa2356b099461cf37a3378197c26fa124b4;p=dbsrgits%2FDBIx-Class.git Think before commit --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index a4cc654..7b34a86 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1927,7 +1927,7 @@ B: This feature is still experimental. sub as_query { my $self = shift; - return $self->result_source->storage->as_query($self); + return $self->result_source->storage->as_query($self->_resolved_attrs); } =head2 find_or_new diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index ff18654..c9f816e 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -914,27 +914,25 @@ sub _prep_for_execute { =over 4 -=item Arguments: none +=item Arguments: $rs_attrs =item Return Value: \[ $sql, @bind ] =back Returns the SQL statement and bind vars that would result from the given -ResultSet (does not actually run a query) +ResultSet attributes (does not actually run a query) =cut sub as_query { - my ($self, $rs) = @_; + my ($self, $rs_attr) = @_; my $sql_maker = $self->sql_maker; local $sql_maker->{for}; - my $attr = $rs->_resolved_attrs; - # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) = $self->_select_args(...); - my @args = $self->_select_args($attr->{from}, $attr->{select}, $attr->{where}, $attr); + my @args = $self->_select_args($rs_attr->{from}, $rs_attr->{select}, $rs_attr->{where}, $rs_attr); # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]); my ($sql, $bind) = $self->_prep_for_execute(