Added documentation for from => $rs->as_query
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI.pm
index e8cc52c..4e4d4e7 100644 (file)
@@ -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->{$_} ) : ()  }