r38106 - in /branches/upstream/libdbix-class-perl/current: ./ lib/DBIx/ lib/DBIx/Class/ lib/DBIx/Class/Storage/ lib/DBIx/Class/Storage/DBI/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Jun 14 21:24:59 UTC 2009


Author: jawnsy-guest
Date: Sun Jun 14 21:24:53 2009
New Revision: 38106

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38106
Log:
[svn-upgrade] Integrating new upstream version, libdbix-class-perl (0.08107)

Modified:
    branches/upstream/libdbix-class-perl/current/Changes
    branches/upstream/libdbix-class-perl/current/META.yml
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class.pm
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSet.pm
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSource.pm
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Row.pm
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI.pm
    branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI/Replicated.pm
    branches/upstream/libdbix-class-perl/current/t/74mssql.t
    branches/upstream/libdbix-class-perl/current/t/84serialize.t

Modified: branches/upstream/libdbix-class-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/Changes?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/Changes (original)
+++ branches/upstream/libdbix-class-perl/current/Changes Sun Jun 14 21:24:53 2009
@@ -1,4 +1,10 @@
 Revision history for DBIx::Class
+
+0.08107 2009-06-14 08:21:00 (UTC)
+        - Fix serialization regression introduced in 0.08103 (affects
+          Cursor::Cached)
+        - POD fixes
+        - Fixed incomplete ::Replicated debug output
 
 0.08106 2009-06-11 21:42:00 (UTC)
         - Switched SQLite storage driver to DateTime::Format::SQLite

Modified: branches/upstream/libdbix-class-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/META.yml?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/META.yml (original)
+++ branches/upstream/libdbix-class-perl/current/META.yml Sun Jun 14 21:24:53 2009
@@ -50,4 +50,4 @@
   MailingList: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
   license: http://dev.perl.org/licenses/
   repository: http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/
-version: 0.08106
+version: 0.08107

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class.pm Sun Jun 14 21:24:53 2009
@@ -24,7 +24,7 @@
 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
 # brain damage and presumably various other packaging systems too
 
-$VERSION = '0.08106';
+$VERSION = '0.08107';
 
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSet.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSet.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSet.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSet.pm Sun Jun 14 21:24:53 2009
@@ -2440,7 +2440,7 @@
       $attrs->{from}
         ||
       [{
-        -result_source => $source,
+        -source_handle => $source->handle,
         -alias => $attrs->{alias},
         $attrs->{alias} => $source->from,
       }]
@@ -2550,7 +2550,7 @@
   }
 
   $attrs->{from} ||= [ {
-    -result_source => $source,
+    -source_handle => $source->handle,
     -alias => $self->{attrs}{alias},
     $self->{attrs}{alias} => $source->from,
   } ];
@@ -3287,9 +3287,21 @@
     # SELECT child.* FROM person child
     # INNER JOIN person father ON child.father_id = father.id
 
-If you need to express really complex joins or you need a subselect, you
+You can select from a subquery by passing a resultset to from as follows.
+
+    $schema->resultset('Artist')->search( 
+        undef, 
+        {   alias => 'artist2',
+            from  => [ { artist2 => $artist_rs->as_query } ],
+        } );
+
+    # and you'll get sql like this..
+    # SELECT artist2.artistid, artist2.name, artist2.rank, artist2.charfield FROM 
+    #   ( SELECT me.artistid, me.name, me.rank, me.charfield FROM artists me ) artist2
+
+If you need to express really complex joins, you
 can supply literal SQL to C<from> via a scalar reference. In this case
-the contents of the scalar will replace the table name asscoiated with the
+the contents of the scalar will replace the table name associated with the
 resultsource.
 
 WARNING: This technique might very well not work as expected on chained

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSource.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSource.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSource.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/ResultSource.pm Sun Jun 14 21:24:53 2009
@@ -1135,7 +1135,7 @@
 
     my $rel_src = $self->related_source($join);
     return [ { $as => $rel_src->from,
-               -result_source => $rel_src,
+               -source_handle => $rel_src->handle,
                -join_type => $type,
                -join_path => [@$jpath, $join],
                -alias => $as,

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Row.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Row.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Row.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Row.pm Sun Jun 14 21:24:53 2009
@@ -647,6 +647,8 @@
 Returns all loaded column data as a hash, containing raw values. To
 get just one value for a particular column, use L</get_column>.
 
+See L</get_inflated_columns> to get the inflated values.
+
 =cut
 
 sub get_columns {

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI.pm Sun Jun 14 21:24:53 2009
@@ -1191,23 +1191,31 @@
 
 sub _select {
   my $self = shift;
+
+  # localization is neccessary as
+  # 1) there is no infrastructure to pass this around (easy to do, but will wait)
+  # 2) _select_args sets it and _prep_for_execute consumes it
   my $sql_maker = $self->sql_maker;
   local $sql_maker->{for};
+
   return $self->_execute($self->_select_args(@_));
 }
 
 sub _select_args_to_query {
   my $self = shift;
 
+  # localization is neccessary as
+  # 1) there is no infrastructure to pass this around (easy to do, but will wait)
+  # 2) _select_args sets it and _prep_for_execute consumes it
   my $sql_maker = $self->sql_maker;
   local $sql_maker->{for};
 
-  # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) 
+  # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset)
   #  = $self->_select_args($ident, $select, $cond, $attrs);
   my ($op, $bind, $ident, $bind_attrs, @args) =
     $self->_select_args(@_);
 
-  # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
+  # my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
   my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, \@args);
 
   return \[ "($sql)", @{ $prepared_bind || [] }];
@@ -1216,9 +1224,8 @@
 sub _select_args {
   my ($self, $ident, $select, $condition, $attrs) = @_;
 
-  my $for = delete $attrs->{for};
   my $sql_maker = $self->sql_maker;
-  $sql_maker->{for} = $for;
+  $sql_maker->{for} = delete $attrs->{for};
 
   my $order = { map
     { $attrs->{$_} ? ( $_ => $attrs->{$_} ) : ()  }
@@ -1287,8 +1294,8 @@
         $tabinfo = $_->[0];
       }
 
-      $alias2source->{$tabinfo->{-alias}} = $tabinfo->{-result_source}
-        if ($tabinfo->{-result_source});
+      $alias2source->{$tabinfo->{-alias}} = $tabinfo->{-source_handle}->resolve
+        if ($tabinfo->{-source_handle});
     }
   }
 

Modified: branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI/Replicated.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI/Replicated.pm?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI/Replicated.pm (original)
+++ branches/upstream/libdbix-class-perl/current/lib/DBIx/Class/Storage/DBI/Replicated.pm Sun Jun 14 21:24:53 2009
@@ -366,10 +366,11 @@
     $res = $self->$next($info, @extra);
   }
 
-  # May have to reapply role if master will be reblessed to a more specific
-  # driver.
-  $self->master->_determine_driver;
-  DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($self->master);
+  # Make sure master is blessed into the correct class and apply role to it.
+  my $master = $self->master;
+  $master->_determine_driver;
+  Moose::Meta::Class->initialize(ref $master);
+  DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($master);
 
   $wantarray ? @res : $res;
 };
@@ -405,7 +406,6 @@
 sub _build_master {
   my $self = shift @_;
   my $master = DBIx::Class::Storage::DBI->new($self->schema);
-  DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($master);
   $master
 }
 

Modified: branches/upstream/libdbix-class-perl/current/t/74mssql.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/t/74mssql.t?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/t/74mssql.t (original)
+++ branches/upstream/libdbix-class-perl/current/t/74mssql.t Sun Jun 14 21:24:53 2009
@@ -1,5 +1,12 @@
 use strict;
 use warnings;  
+
+# use this if you keep a copy of DBD::Sybase linked to FreeTDS somewhere else
+BEGIN {
+  if (my $lib_dirs = $ENV{DBICTEST_MSSQL_PERL5LIB}) {
+    unshift @INC, $_ for split /:/, $lib_dirs;
+  }
+}
 
 use Test::More;
 use lib qw(t/lib);

Modified: branches/upstream/libdbix-class-perl/current/t/84serialize.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-perl/current/t/84serialize.t?rev=38106&op=diff
==============================================================================
--- branches/upstream/libdbix-class-perl/current/t/84serialize.t (original)
+++ branches/upstream/libdbix-class-perl/current/t/84serialize.t Sun Jun 14 21:24:53 2009
@@ -2,6 +2,7 @@
 use warnings;  
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 use Storable qw(dclone freeze thaw);
@@ -20,10 +21,11 @@
     },
 );
 
-plan tests => (7 * keys %stores);
+plan tests => (11 * keys %stores);
 
 for my $name (keys %stores) {
     my $store = $stores{$name};
+    my $copy;
 
     my $artist = $schema->resultset('Artist')->find(1);
     
@@ -39,22 +41,35 @@
         DBICTest::CD->result_source_instance->schema(undef);
     }
 
-    my $copy = eval { $store->($artist) };
+    lives_ok { $copy = $store->($artist) } "serialize row object lives: $name";
     is_deeply($copy, $artist, "serialize row object works: $name");
 
+    my $cd_rs = $artist->search_related("cds");
+
+    # test that a result source can be serialized as well
+
+    $cd_rs->_resolved_attrs;  # this builds up the {from} attr
+
+    lives_ok {
+      $copy = $store->($cd_rs);
+      is_deeply (
+        [ $copy->all ],
+        [ $cd_rs->all ],
+        "serialize resultset works: $name",
+      );
+    } "serialize resultset lives: $name";
+
     # Test that an object with a related_resultset can be serialized.
-    my @cds = $artist->related_resultset("cds");
-
     ok $artist->{related_resultsets}, 'has key: related_resultsets';
 
-    $copy = eval { $store->($artist) };
+    lives_ok { $copy = $store->($artist) } "serialize row object with related_resultset lives: $name";
     for my $key (keys %$artist) {
         next if $key eq 'related_resultsets';
         next if $key eq '_inflated_column';
         is_deeply($copy->{$key}, $artist->{$key},
                   qq[serialize with related_resultset "$key"]);
     }
-  
+
     ok eval { $copy->discard_changes; 1 } or diag $@;
     is($copy->id, $artist->id, "IDs still match ");
 }




More information about the Pkg-perl-cvs-commits mailing list