[Bast-commits] r4614 - DBIx-Class/0.08/trunk/lib/DBIx/Class

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Thu Jul 24 07:58:45 BST 2008


Author: castaway
Date: 2008-07-24 07:58:45 +0100 (Thu, 24 Jul 2008)
New Revision: 4614

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
Log:
Added doc patch about race condition in find_or_create from MNDRIX


Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2008-07-24 06:42:34 UTC (rev 4613)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2008-07-24 06:58:45 UTC (rev 4614)
@@ -1751,6 +1751,12 @@
     { key => 'cd_artist_title' }
   );
 
+Note: Because find_or_create() reads from the database and then
+possibly inserts based on the result, this method is subject to a race
+condition. Another process could create a record in the table after
+the find has completed and before the create has started. To avoid
+this problem, use find_or_create() inside a transaction.
+
 See also L</find> and L</update_or_create>. For information on how to declare
 unique constraints, see L<DBIx::Class::ResultSource/add_unique_constraint>.
 




More information about the Bast-commits mailing list