X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=1ed743d7c15cb1c96f72f3ef40b59c73310f0217;hb=f1952f5c69e092d9ce416586f29942f8c2f66bce;hp=05ae3dbc27c7f449063d65d93039c50ff17f9ad6;hpb=7d7d697500011de9ac151b6303f27e56f696cec6;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 05ae3db..1ed743d 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1191,14 +1191,25 @@ sub _per_row_update_delete { sub _select { my $self = shift; + + # localization is neccessary as + # 1) there is no infrastructure to pass this around (easy to do, but will wait) + # 2) _select_args sets it and _prep_for_execute consumes it my $sql_maker = $self->sql_maker; local $sql_maker->{for}; + return $self->_execute($self->_select_args(@_)); } sub _select_args_to_query { my $self = shift; + # localization is neccessary as + # 1) there is no infrastructure to pass this around (easy to do, but will wait) + # 2) _select_args sets it and _prep_for_execute consumes it + my $sql_maker = $self->sql_maker; + local $sql_maker->{for}; + # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) # = $self->_select_args($ident, $select, $cond, $attrs); my ($op, $bind, $ident, $bind_attrs, @args) = @@ -1206,16 +1217,19 @@ 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 { my ($self, $ident, $select, $condition, $attrs) = @_; - my $for = delete $attrs->{for}; my $sql_maker = $self->sql_maker; - $sql_maker->{for} = $for; + $sql_maker->{for} = delete $attrs->{for}; my $order = { map { $attrs->{$_} ? ( $_ => $attrs->{$_} ) : () } @@ -1284,8 +1298,8 @@ sub _resolve_ident_sources { $tabinfo = $_->[0]; } - $alias2source->{$tabinfo->{-alias}} = $tabinfo->{-result_source} - if ($tabinfo->{-result_source}); + $alias2source->{$tabinfo->{-alias}} = $tabinfo->{-source_handle}->resolve + if ($tabinfo->{-source_handle}); } }