Documented use of cursor->next for fast but uncomfortable data fetches
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Manual / Cookbook.pod
index 52bb889..b3dff9c 100644 (file)
@@ -571,13 +571,13 @@ It's as simple as overriding the C<new> method.  Note the use of
 C<next::method>.
 
   sub new {
-    my ( $self, $attrs ) = @_;
+    my ( $class, $attrs ) = @_;
 
     $attrs->{foo} = 'bar' unless defined $attrs->{foo};
 
-    $self->next::method($attrs);
+    my $new = $class->next::method($attrs);
 
-    return $self;
+    return $new;
   }
 
 For more information about C<next::method>, look in the L<Class::C3> 
@@ -1145,6 +1145,22 @@ C<inflate_result>:
      }
   }
 
+=head2 Get raw data for blindingly fast results
+
+If the C<inflate_result> solution above is not fast enough for you, you
+can use a DBIx::Class to return values exactly as they come out of the
+data base with none of the convenience methods wrapped round them.
+
+This is used like so:-
+
+  my $cursor = $rs->cursor
+  while (my @vals = $cursor->next) {
+      # use $val[0..n] here
+  }
+
+You will need to map the array offsets to particular columns (you can
+use the I<select> attribute of C<search()> to force ordering).
+
 =head2 Want to know if find_or_create found or created a row?
 
 Just use C<find_or_new> instead, then check C<in_storage>: