[Bast-commits] r5431 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class t t/lib t/lib/DBICTest

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Mon Feb 9 20:27:27 GMT 2009


Author: groditi
Date: 2009-02-09 20:27:27 +0000 (Mon, 09 Feb 2009)
New Revision: 5431

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/trunk/t/60core.t
   DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
   DBIx-Class/0.08/trunk/t/lib/sqlite.sql
Log:
backporting the set_column/store_column fix

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2009-02-09 09:37:34 UTC (rev 5430)
+++ DBIx-Class/0.08/trunk/Changes	2009-02-09 20:27:27 UTC (rev 5431)
@@ -17,6 +17,8 @@
         - new order_by => { -desc => 'colname' } syntax supported with
           SQLA >= 1.50
         - PG array datatype supported with SQLA >= 1.50
+        - insert should use store_column, not set_column to avoid marking
+          clean just-stored values as dirty. New test for this (groditi)
 
 0.08099_05 2008-10-30 21:30:00 (UTC)
         - Rewritte of Storage::DBI::connect_info(), extended with an

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-02-09 09:37:34 UTC (rev 5430)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-02-09 20:27:27 UTC (rev 5431)
@@ -263,7 +263,9 @@
   }
 
   my $updated_cols = $source->storage->insert($source, { $self->get_columns });
-  $self->set_columns($updated_cols);
+  foreach my $col (keys %$updated_cols) {
+    $self->store_column($col, $updated_cols->{$col});
+  }
 
   ## PK::Auto
   my @auto_pri = grep {

Modified: DBIx-Class/0.08/trunk/t/60core.t
===================================================================
--- DBIx-Class/0.08/trunk/t/60core.t	2009-02-09 09:37:34 UTC (rev 5430)
+++ DBIx-Class/0.08/trunk/t/60core.t	2009-02-09 20:27:27 UTC (rev 5431)
@@ -7,7 +7,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 86;
+plan tests => 88;
 
 eval { require DateTime::Format::MySQL };
 my $NO_DTFM = $@ ? 1 : 0;
@@ -379,3 +379,11 @@
     my $table = $class->table($class->table);
     is($table, $class->table, '->table($table) returns $table');
 }
+
+#make sure insert doesn't use set_column
+{
+  my $en_row = $schema->resultset('Encoded')->new_result({encoded => 'wilma'});
+  is($en_row->encoded, 'amliw', 'new encodes');
+  $en_row->insert;
+  is($en_row->encoded, 'amliw', 'insert does not encode again');
+}

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm	2009-02-09 09:37:34 UTC (rev 5430)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm	2009-02-09 20:27:27 UTC (rev 5431)
@@ -44,7 +44,7 @@
   ),
   qw/SelfRefAlias TreeLike TwoKeyTreeLike Event EventTZ NoPrimaryKey/,
   qw/Collection CollectionObject TypedObject Owners BooksInLibrary/,
-  qw/ForceForeign/,
+  qw/ForceForeign Encoded/,
 );
 
 sub sqlt_deploy_hook {

Modified: DBIx-Class/0.08/trunk/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2009-02-09 09:37:34 UTC (rev 5430)
+++ DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2009-02-09 20:27:27 UTC (rev 5431)
@@ -411,5 +411,12 @@
   value varchar(100) NOT NULL
 );
 
+--
+-- Table: encoded
+--
+CREATE TABLE encoded (
+  id INTEGER PRIMARY KEY NOT NULL,
+  encoded varchar(100) NOT NULL
+);
 
 COMMIT;




More information about the Bast-commits mailing list