From: Peter Rabbitson Date: Sat, 13 Jun 2009 17:31:55 +0000 (+0000) Subject: really local()ize for as the author intended X-Git-Tag: v0.08107~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=23dfbf8cfa4d7105bebeefac13ad2a73c71c3d3f;p=dbsrgits%2FDBIx-Class.git really local()ize for as the author intended --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index e8cc52c..4e4d4e7 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1191,13 +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) = @@ -1212,10 +1224,8 @@ sub _select_args_to_query { sub _select_args { my ($self, $ident, $select, $condition, $attrs) = @_; - my $for = delete $attrs->{for}; my $sql_maker = $self->sql_maker; - - local $sql_maker->{for} = $for; + $sql_maker->{for} = delete $attrs->{for}; my $order = { map { $attrs->{$_} ? ( $_ => $attrs->{$_} ) : () }