Merge 'DBIx-Class-C3' into 'DBIx-Class-resultset'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index 6178af7..f6ebb56 100644 (file)
@@ -9,7 +9,7 @@ use Data::Page;
 
 =head1 NAME
 
-DBIX::Class::Recordset - Responsible for fetching and creating recordsets.
+DBIX::Class::ResultSet - Responsible for fetching and creating resultset.
 
 =head1 SYNOPSIS;
 
@@ -17,7 +17,7 @@ $rs=MyApp::DB::Class->search(registered=>1);
 
 =head1 DESCRIPTION
 
-The recordset is also know as an iterator.
+The resultset is also known as an iterator.
 
 =head1 METHODS
 
@@ -25,7 +25,7 @@ The recordset is also know as an iterator.
 
 =item new  <db_class> <attrs>
 
-The recordset constructor. Takes a db class and an
+The resultset constructor. Takes a db class and an
 attribute hash (see below for more info on attributes)
 
 =cut
@@ -71,7 +71,7 @@ sub new {
 
 =item cursor
 
-Return a storage driven cursor to the given record set.
+Return a storage driven cursor to the given resultset.
 
 =cut
 
@@ -89,7 +89,7 @@ sub cursor {
 
 =item slice <first> <last>
 
-return a number of elements from the given record set.
+return a number of elements from the given resultset.
 
 =cut
 
@@ -105,7 +105,7 @@ sub slice {
 
 =item next 
 
-Returns the next element in this record set.
+Returns the next element in this resultset.
 
 =cut
 
@@ -118,7 +118,9 @@ sub next {
 
 sub _construct_object {
   my ($self, @row) = @_;
-  my @cols = $self->{class}->_select_columns;
+  my @cols = @{ $self->{attrs}{cols} };
+  s/^me\.// for @cols;
+  @cols = grep { /\(/ or ! /\./ } @cols;
   my $new;
   unless ($self->{attrs}{prefetch}) {
     $new = $self->{class}->_row_to_object(\@cols, \@row);
@@ -135,7 +137,10 @@ sub _construct_object {
         unless defined $rel_obj->{attrs}{accessor};
       if ($rel_obj->{attrs}{accessor} eq 'single') {
         foreach my $pri ($rel_obj->{class}->primary_columns) {
-          next PRE unless defined $fetched->get_column($pri);
+          unless (defined $fetched->get_column($pri)) {
+            undef $fetched;
+            last;
+          }
         }
         $new->{_relationship_data}{$pre} = $fetched;
       } elsif ($rel_obj->{attrs}{accessor} eq 'filter') {
@@ -179,7 +184,7 @@ sub count {
 
 =item all
 
-Returns all elements in the recordset. Is called implictly if the search
+Returns all elements in the resultset. Is called implictly if the search
 method is used in list context.
 
 =cut
@@ -192,7 +197,7 @@ sub all {
 
 =item reset
 
-Reset this recordset's cursor, so you can iterate through the elements again.
+Reset this resultset's cursor, so you can iterate through the elements again.
 
 =cut
 
@@ -204,7 +209,7 @@ sub reset {
 
 =item first
 
-resets the recordset and returns the first element.
+resets the resultset and returns the first element.
 
 =cut
 
@@ -214,7 +219,7 @@ sub first {
 
 =item delete
 
-Deletes all elements in the recordset.
+Deletes all elements in the resultset.
 
 =cut
 
@@ -246,7 +251,7 @@ sub pager {
 
 =item page <page>
 
-Returns a new recordset representing a given page.
+Returns a new resultset representing a given page.
 
 =cut
 
@@ -261,7 +266,7 @@ sub page {
 
 =head1 Attributes
 
-The recordset is responsible for handling the various attributes that
+The resultset is responsible for handling the various attributes that
 can be passed in with the search functions. Here's an overview of them:
 
 =over 4
@@ -300,11 +305,6 @@ For paged resultsset, how  many rows per page
 
 For paged resultsset, which page to start on.
 
-=item accesor
-
-Tells the  recordset how to prefetch relations. Can either be 'single' or
-'filter'.
-
 =back
 
 1;