[Bast-commits] r3948 - in DBIx-Class-Partitioned/1.000/trunk:
lib/DBIx/Class lib/DBIx/Class/ResultSource/Table t
edenc at dev.catalyst.perl.org
edenc at dev.catalyst.perl.org
Thu Jan 17 00:03:17 GMT 2008
Author: edenc
Date: 2008-01-17 00:03:16 +0000 (Thu, 17 Jan 2008)
New Revision: 3948
Removed:
DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partition.pm
Modified:
DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/Partitioned.pm
DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partitioned.pm
DBIx-Class-Partitioned/1.000/trunk/t/01-basic.t
Log:
cleaning up unnecessary logic
Modified: DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/Partitioned.pm
===================================================================
--- DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/Partitioned.pm 2008-01-16 23:27:47 UTC (rev 3947)
+++ DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/Partitioned.pm 2008-01-17 00:03:16 UTC (rev 3948)
@@ -135,8 +135,8 @@
my $self = shift;
$self->next::method(@_);
if ( my $part = $self->_current_partition && !$self->is_partition_row ) {
- $self->partition($part)->resultset->find( { $self->get_columns } )
- ->delete;
+ $self->result_source->partition($part)
+ ->resultset->find( { $self->get_columns } )->delete;
$self->_current_partition('');
}
return $self;
Deleted: DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partition.pm
===================================================================
--- DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partition.pm 2008-01-16 23:27:47 UTC (rev 3947)
+++ DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partition.pm 2008-01-17 00:03:16 UTC (rev 3948)
@@ -1,22 +0,0 @@
-package DBIx::Class::ResultSource::Table::Partition;
-
-use warnings;
-use strict;
-
-use Scalar::Util ();
-
-use base qw/DBIx::Class::ResultSource::Table/;
-
-__PACKAGE__->mk_group_accessors( simple => qw/original_source/ );
-
-sub new {
- my $self = shift->next::method(@_);
- Scalar::Util::weaken( $self->{original_source} );
- return $self;
-}
-
-sub partition {
- return shift->original_source->partition(@_);
-}
-
-1;
Modified: DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partitioned.pm
===================================================================
--- DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partitioned.pm 2008-01-16 23:27:47 UTC (rev 3947)
+++ DBIx-Class-Partitioned/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Partitioned.pm 2008-01-17 00:03:16 UTC (rev 3948)
@@ -3,7 +3,6 @@
use warnings;
use strict;
-use DBIx::Class::ResultSource::Table::Partition;
use base qw/DBIx::Class::ResultSource::Table/;
__PACKAGE__->mk_group_accessors( 'simple' => qw/_partitions _is_registered/ );
@@ -11,8 +10,9 @@
sub schema {
my $self = shift;
my ($schema) = @_;
+
# ugh...
- if ( !$self->_is_registered && ref $schema) {
+ if ( !$self->_is_registered && ref $schema ) {
foreach my $partition_source ( values %{ $self->_partitions } ) {
$schema->register_source(
$partition_source->source_name => $partition_source );
@@ -26,8 +26,7 @@
my ( $self, @parts ) = @_;
$self->_partitions( {} );
foreach my $partition (@parts) {
- my $new_source =
- DBIx::Class::ResultSource::Table::Partition->new($self);
+ my $new_source = DBIx::Class::ResultSource::Table->new($self);
my $new_source_name = join '::', map { ucfirst } split '_', $partition;
$new_source->source_name($new_source_name);
$new_source->name($partition);
@@ -51,4 +50,6 @@
return;
}
+sub original_source { return shift }
+
1;
Modified: DBIx-Class-Partitioned/1.000/trunk/t/01-basic.t
===================================================================
--- DBIx-Class-Partitioned/1.000/trunk/t/01-basic.t 2008-01-16 23:27:47 UTC (rev 3947)
+++ DBIx-Class-Partitioned/1.000/trunk/t/01-basic.t 2008-01-17 00:03:16 UTC (rev 3948)
@@ -36,6 +36,9 @@
$user->update;
ok( $schema->resultset('ActiveUser')->search( { $user->get_columns } )
->count );
+ ok( $user_rs->result_source->partition('active_user')
+ ->resultset->search( { $user->get_columns } )->count );
+
is( $user->affiliations->first->name, 'foo' );
is( $user->posts->first->title, 'foo' );
is( $user->posts->first->content, 'bar' );
More information about the Bast-commits
mailing list