[Bast-commits] r4071 - in DBIx-Class/0.08/branches/cdbicompat_integration: . lib/DBIx/Class lib/DBIx/Class/CDBICompat t/cdbi-t

schwern at dev.catalyst.perl.org schwern at dev.catalyst.perl.org
Wed Feb 13 09:07:35 GMT 2008


Author: schwern
Date: 2008-02-13 09:07:34 +0000 (Wed, 13 Feb 2008)
New Revision: 4071

Added:
   DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_to_undef.t
Modified:
   DBIx-Class/0.08/branches/cdbicompat_integration/
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/CDBICompat/GetSet.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_vs_DateTime.t
Log:
 r54512 at windhund:  schwern | 2008-02-13 01:06:42 -0800
 Test that DateTime objects can safely be updated twice (which is what triggers
 the equality check).
 
 Remove the stringification to shield broken equality since DateTime seems
 to work.
 
 This also shuts up a warning in GetSet when you set to an undef value.
 Test that.
 
 Change from bitwise xor to regular xor since bitwise is overkill and nobody
 knows what ^ is.



Property changes on: DBIx-Class/0.08/branches/cdbicompat_integration
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54511
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:3943
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
   + 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54512
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:3943
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/CDBICompat/GetSet.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/CDBICompat/GetSet.pm	2008-02-13 09:07:17 UTC (rev 4070)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/CDBICompat/GetSet.pm	2008-02-13 09:07:34 UTC (rev 4071)
@@ -17,11 +17,6 @@
 
 sub set {
   my($self, %data) = @_;
-
-  # set_columns() is going to do a string comparison before setting.
-  # This breaks on DateTime objects (whose comparison is arguably broken)
-  # so we stringify anything first.
-  $data{$_} = "$data{$_}" for keys %data;
   return shift->set_columns(\%data);
 }
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm	2008-02-13 09:07:17 UTC (rev 4070)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm	2008-02-13 09:07:34 UTC (rev 4071)
@@ -460,7 +460,7 @@
   my $old = $self->get_column($column);
   my $ret = $self->store_column(@_);
   $self->{_dirty_columns}{$column} = 1
-    if (defined $old ^ defined $ret) || (defined $old && $old ne $ret);
+    if (defined $old xor defined $ret) || (defined $old && $old ne $ret);
 
   # XXX clear out the relation cache for this column
   delete $self->{related_resultsets}{$column};

Added: DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_to_undef.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_to_undef.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_to_undef.t	2008-02-13 09:07:34 UTC (rev 4071)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More;
+use Test::NoWarnings;
+
+BEGIN {
+  eval "use DBIx::Class::CDBICompat;";
+  plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
+    if $@;
+  plan skip_all => "DateTime required" unless eval { require DateTime };
+  plan tests => 1;
+}
+
+{
+    package Thing;
+
+    use base 'DBIx::Class::Test::SQLite';
+
+    Thing->columns(All  => qw[thing_id this that date]);
+}
+
+my $thing = Thing->construct({ thing_id => 23, this => 42 });
+$thing->set( this => undef );
+$thing->discard_changes;

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_vs_DateTime.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_vs_DateTime.t	2008-02-13 09:07:17 UTC (rev 4070)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/cdbi-t/set_vs_DateTime.t	2008-02-13 09:07:34 UTC (rev 4071)
@@ -2,6 +2,7 @@
 
 use strict;
 use Test::More;
+use Test::Exception;
 
 BEGIN {
   eval "use DBIx::Class::CDBICompat;";
@@ -20,9 +21,12 @@
 }
 
 my $thing = Thing->construct({ thing_id => 23, date => "01-02-1994" });
-eval {
-  $thing->set( date => DateTime->now );
+my $date = DateTime->now;
+lives_ok {
+  $thing->set( date => $date );
+  $thing->set( date => $date );
 };
-is $@, '';
 
+
+
 $thing->discard_changes;




More information about the Bast-commits mailing list