From: Matt S Trout Date: Mon, 26 Dec 2005 00:46:52 +0000 (+0000) Subject: ResultSetInstance is now a component on DB, some test cleanup X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d679367e554c57e39aac9419b13a582e02916bd;p=dbsrgits%2FDBIx-Class-Historic.git ResultSetInstance is now a component on DB, some test cleanup --- diff --git a/lib/DBIx/Class/Core.pm b/lib/DBIx/Class/Core.pm index 5db8b01..9cb474e 100644 --- a/lib/DBIx/Class/Core.pm +++ b/lib/DBIx/Class/Core.pm @@ -12,7 +12,6 @@ __PACKAGE__->load_components(qw/ PK Row TableInstance - ResultSetInstance Exception AccessorGroup/); diff --git a/lib/DBIx/Class/DB.pm b/lib/DBIx/Class/DB.pm index fed7507..fd8d5b7 100644 --- a/lib/DBIx/Class/DB.pm +++ b/lib/DBIx/Class/DB.pm @@ -5,9 +5,13 @@ use DBIx::Class::Storage::DBI; use DBIx::Class::ClassResolver::PassThrough; use DBI; +__PACKAGE__->load_components(qw/ResultSetInstance/); + *dbi_commit = \&txn_commit; *dbi_rollback = \&txn_rollback; +sub storage { shift->storage_instance(@_); } + =head1 NAME DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance @@ -46,7 +50,6 @@ it. See resolve_class below. =cut -__PACKAGE__->mk_classdata('storage'); __PACKAGE__->mk_classdata('class_resolver' => 'DBIx::Class::ClassResolver::PassThrough'); @@ -63,7 +66,7 @@ sub connection { my ($class, @info) = @_; my $storage = DBIx::Class::Storage::DBI->new; $storage->connect_info(\@info); - $class->storage($storage); + $class->mk_classdata('storage_instance' => $storage); } =head2 txn_begin diff --git a/lib/DBIx/Class/ResultSetInstance.pm b/lib/DBIx/Class/ResultSetInstance.pm index 736ac71..0fcacd8 100644 --- a/lib/DBIx/Class/ResultSetInstance.pm +++ b/lib/DBIx/Class/ResultSetInstance.pm @@ -8,6 +8,4 @@ sub search_like { shift->resultset_instance->search_like(@_); } sub count { shift->resultset_instance->count(@_); } sub count_literal { shift->resultset_instance->count_literal(@_); } -__PACKAGE__->mk_classdata('resultset_instance'); - 1; diff --git a/lib/DBIx/Class/TableInstance.pm b/lib/DBIx/Class/TableInstance.pm index 93e08c6..e9a92ce 100644 --- a/lib/DBIx/Class/TableInstance.pm +++ b/lib/DBIx/Class/TableInstance.pm @@ -50,7 +50,7 @@ sub add_columns { sub resultset_instance { my $class = shift; my $table = $class->table_instance->new($class->table_instance); - $table->storage($class->storage); + $table->storage($class->storage_instance); $table->result_class($class); return $table->resultset; } diff --git a/lib/DBIx/Class/UUIDColumns.pm b/lib/DBIx/Class/UUIDColumns.pm index dca0c58..2d951e3 100644 --- a/lib/DBIx/Class/UUIDColumns.pm +++ b/lib/DBIx/Class/UUIDColumns.pm @@ -39,6 +39,7 @@ sub uuid_columns { sub insert { my ($self) = @_; + warn "Got here"; for my $column (@{$self->uuid_auto_columns}) { $self->store_column( $column, $self->get_uuid ) unless defined $self->get_column( $column ); diff --git a/t/run/08inflate.tl b/t/run/08inflate.tl index 9a69380..96d9134 100644 --- a/t/run/08inflate.tl +++ b/t/run/08inflate.tl @@ -5,10 +5,11 @@ plan skip_all => "Need DateTime for inflation tests" if $@; plan tests => 3; -DBICTest::CD->inflate_column( 'year', +DBICTest::Schema::CD->inflate_column( 'year', { inflate => sub { DateTime->new( year => shift ) }, deflate => sub { shift->year } } ); +Class::C3->reinitialize; # inflation test my $cd = DBICTest::CD->find(3); diff --git a/t/run/08inflate_has_a.tl b/t/run/08inflate_has_a.tl index e329c2a..fe4833a 100644 --- a/t/run/08inflate_has_a.tl +++ b/t/run/08inflate_has_a.tl @@ -5,12 +5,13 @@ plan skip_all => "Need DateTime for inflation tests" if $@; plan tests => 6; -DBICTest::CD->load_components(qw/CDBICompat::HasA/); +DBICTest::Schema::CD->load_components(qw/CDBICompat::HasA/); -DBICTest::CD->has_a( 'year', 'DateTime', +DBICTest::Schema::CD->has_a( 'year', 'DateTime', inflate => sub { DateTime->new( year => shift ) }, deflate => sub { shift->year } ); +Class::C3->reinitialize; # inflation test my $cd = DBICTest::CD->find(3); diff --git a/t/run/19uuid.tl b/t/run/19uuid.tl index 42c91a8..8c2f464 100644 --- a/t/run/19uuid.tl +++ b/t/run/19uuid.tl @@ -4,8 +4,9 @@ eval 'use Data::UUID ; 1' or plan skip_all, 'Install Data::UUID run this test'; plan tests => 1; -DBICTest::Artist->load_components('UUIDColumns'); -DBICTest::Artist->uuid_columns('name'); +DBICTest::Schema::Artist->load_components('UUIDColumns'); +DBICTest::Schema::Artist->uuid_columns('name'); +Class::C3->reinitialize(); my $artist = DBICTest::Artist->create( { artistid => 100 } ); like $artist->name, qr/[\w-]{36}/, 'got something like uuid';