From: Peter Rabbitson Date: Sun, 14 Jun 2009 09:33:22 +0000 (+0000) Subject: Forgotten piece of as_query refactor X-Git-Tag: v0.08108~89 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6a717da1b886f6daa4dc1a4cad73a0894092489;p=dbsrgits%2FDBIx-Class.git Forgotten piece of as_query refactor --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index fad673f..fe622b9 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1930,7 +1930,13 @@ sub as_query { my $attrs = $self->_resolved_attrs_copy; - my ($sqlbind, $bind_attrs) = $self->result_source->storage + # For future use: + # + # in list ctx: + # my ($sql, \@bind, \%dbi_bind_attrs) = _select_args_to_query (...) + # $sql also has no wrapping parenthesis in list ctx + # + my $sqlbind = $self->result_source->storage ->_select_args_to_query ($attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs); return $sqlbind; diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 4e4d4e7..1ed743d 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1217,8 +1217,12 @@ sub _select_args_to_query { # my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]); my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, \@args); + $prepared_bind ||= []; - return \[ "($sql)", @{ $prepared_bind || [] }]; + return wantarray + ? ($sql, $prepared_bind, $bind_attrs) + : \[ "($sql)", @$prepared_bind ] + ; } sub _select_args {