Merge 'trunk' into 'replication_dedux'
John Napiorkowski [Tue, 6 May 2008 18:55:17 +0000 (13:55 -0500)]
Changes
lib/DBIx/Class/ResultSet.pm
lib/DBIx/Class/Storage/DBI.pm
t/61findnot.t
t/71mysql.t

diff --git a/Changes b/Changes
index 9bef41b..963dc0b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -12,6 +12,8 @@ Revision history for DBIx::Class
           names should now be consistent and collision-free.
         - Improve handling of explicit key attr in ResultSet::find
         - Add warnings for non-unique ResultSet::find queries
+        - Changed Storage::DBI::Replication to Storage::DBI::Replicated, fixed
+                 some problems using this with versioned databases, added some docs
 
 0.08010 2008-03-01 10:30
         - Fix t/94versioning.t so it passes with latest SQL::Translator
index 8adff20..f56254e 100644 (file)
@@ -571,9 +571,17 @@ sub cursor {
 Inflates the first result without creating a cursor if the resultset has
 any records in it; if not returns nothing. Used by L</find> as an optimisation.
 
-Can optionally take an additional condition *only* - this is a fast-code-path
-method; if you need to add extra joins or similar call ->search and then
-->single without a condition on the $rs returned from that.
+Can optionally take an additional condition B<only> - this is a fast-code-path
+method; if you need to add extra joins or similar call L</search> and then
+L</single> without a condition on the L<DBIx::Class::ResultSet> returned from
+that.
+
+B<Note>: As of 0.08100, this method assumes that the query returns only one
+row. If more than one row is returned, you will receive a warning:
+
+  Query returned more than one row
+
+In this case, you should be using L</first> or L</find> instead.
 
 =cut
 
index 506ad8c..b3ef3d6 100644 (file)
@@ -1288,9 +1288,9 @@ sub select_single {
   my $self = shift;
   my ($rv, $sth, @bind) = $self->_select(@_);
   my @row = $sth->fetchrow_array;
-  ## TODO, we need to decide if we should throw an error when select_single
-  ## returns more than one row
-  #carp "Query returned more than one row" if $sth->fetchrow_array;
+  if(@row && $sth->fetchrow_array) {
+    carp "Query returned more than one row.  SQL that returns multiple rows is DEPRECATED for ->find and ->single";
+  }
   # Need to call finish() to work round broken DBDs
   $sth->finish();
   return @row;
index 17f64fd..8479494 100644 (file)
@@ -54,7 +54,8 @@ ok($art, 'Artist found by key in the resultset');
 $artist_rs = $schema->resultset("Artist");
 warning_is {
   $artist_rs->find({}, { key => 'primary' })
-} "DBIx::Class::ResultSet::find(): Query returned more than one row", "Non-unique find generated a cursor inexhaustion warning";
+} "DBIx::Class::ResultSet::find(): Query returned more than one row.  SQL that returns multiple rows is DEPRECATED for ->find and ->single"
+    =>  "Non-unique find generated a cursor inexhaustion warning";
 
 $artist_rs = $schema->resultset("Artist")->search({}, { prefetch => 'cds' });
 warning_is {
index 3893352..f5ee39e 100644 (file)
@@ -110,8 +110,6 @@ NULLINSEARCH: {
     
     is $artist => undef
     => 'Nothing Found!';
-    
-    warn dump $artist->get_columns if $artist;
 }