[Bast-commits] r6433 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class lib/DBIx/Class/Storage

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Tue May 26 15:20:57 GMT 2009


Author: ribasushi
Date: 2009-05-26 15:20:57 +0000 (Tue, 26 May 2009)
New Revision: 6433

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Minor fixes of the return value of rs->update/delete

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2009-05-26 14:36:55 UTC (rev 6432)
+++ DBIx-Class/0.08/trunk/Changes	2009-05-26 15:20:57 UTC (rev 6433)
@@ -4,6 +4,8 @@
           of these operations will succeed, regardless of the complexity
           of $resultset. distinct, group_by, join, prefetch are all
           supported with expected results
+        - Return value of $rs->delete is now the storage return value
+          and not 1 as it used to be
         - don't pass SQL functions into GROUP BY
         - Remove MultiDistinctEmulation.pm, effectively deprecating
           { select => { distinct => [ qw/col1 col2/ ] } }
@@ -33,6 +35,7 @@
           correctly (RT#28451)
         - "timestamp with time zone" columns (for Pg) now get inflated with a
           time zone information preserved
+        - MSSQL Top limit-emulation improvements (GROUP BY and subquery support)
 
 0.08102 2009-04-30 08:29:00 (UTC)
         - Fixed two subtle bugs when using columns or select/as

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2009-05-26 14:36:55 UTC (rev 6432)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2009-05-26 15:20:57 UTC (rev 6433)
@@ -1527,7 +1527,7 @@
 
 =item Arguments: none
 
-=item Return Value: 1
+=item Return Value: $storage_rv
 
 =back
 
@@ -1535,12 +1535,9 @@
 will not run DBIC cascade triggers. See L</delete_all> if you need triggers
 to run. See also L<DBIx::Class::Row/delete>.
 
-delete may not generate correct SQL for a query with joins or a resultset
-chained from a related resultset.  In this case it will generate a warning:-
+Return value will be the amount of rows deleted; exact type of return value
+is storage-dependent.
 
-In these cases you may find that delete_all is more appropriate, or you
-need to respecify your query in a way that can be expressed without a join.
-
 =cut
 
 sub delete {

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-05-26 14:36:55 UTC (rev 6432)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-05-26 15:20:57 UTC (rev 6433)
@@ -1144,6 +1144,7 @@
   my $guard = $self->txn_scope_guard;
 
   my $subrs_cur = $rs->cursor;
+  my $row_cnt = '0E0';
   while (my @pks = $subrs_cur->next) {
 
     my $cond;
@@ -1156,11 +1157,13 @@
       $op eq 'update' ? $values : (),
       $cond,
     );
+
+    $row_cnt++;
   }
 
   $guard->commit;
 
-  return 1;
+  return $row_cnt;
 }
 
 sub _select {




More information about the Bast-commits mailing list