From: Peter Rabbitson Date: Sat, 24 Apr 2010 00:23:05 +0000 (+0000) Subject: 10% speed up on quoted statement generation X-Git-Tag: v0.08122~109 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=762deea27e3ebd9abc4045656242a762441fd4df;p=dbsrgits%2FDBIx-Class.git 10% speed up on quoted statement generation --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index cea821a..a900056 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -198,7 +198,9 @@ sub _ns_get_rsrc_instance { my $rs = ref ($_[0]) || $_[0]; if ($rs->can ('result_source_instance') ) { - return $rs->result_source_instance; + my $x = $rs->result_source_instance; + use Data::Dumper; + die Dumper $x; } else { $class->throw_exception ( @@ -1316,6 +1318,8 @@ sub _register_source { my $orig_source = $source; $source = $source->new({ %$source, source_name => $moniker }); + use Data::Dumper; + die Dumper $source; $source->schema($self); Scalar::Util::weaken($source->{schema}) if ref($self); diff --git a/t/03podcoverage.t b/t/03podcoverage.t index 3115234..26095f8 100644 --- a/t/03podcoverage.t +++ b/t/03podcoverage.t @@ -14,8 +14,8 @@ unless ( DBICTest::AuthorCheck->is_author || $ENV{AUTOMATED_TESTING} || $ENV{REL require DBIx::Class; unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') ) { my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_podcoverage'); - $ENV{RELEASE_TESTING} || DBICTest::AuthorCheck->is_author - ? die ("Failed to load release-testing module requirements: $missing") + DBICTest::AuthorCheck->is_author + ? die ("Failed to load author-testing module requirements: $missing") : plan skip_all => "Test needs: $missing" } diff --git a/t/39load_namespaces_1.t b/t/39load_namespaces_1.t index 5798518..bf78380 100644 --- a/t/39load_namespaces_1.t +++ b/t/39load_namespaces_1.t @@ -3,21 +3,23 @@ use strict; use warnings; use Test::More; +use Test::Warn; use lib qw(t/lib); use DBICTest; # do not remove even though it is not used -my $warnings; -eval { - local $SIG{__WARN__} = sub { $warnings .= shift }; +warnings_exist ( + sub { package DBICNSTest; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_namespaces; -}; -ok(!$@, 'load_namespaces doesnt die') or diag $@; -like($warnings, qr/load_namespaces found ResultSet class C with no corresponding Result class/, 'Found warning about extra ResultSet classes'); - -like($warnings, qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/, 'Found warning about ResultSets with incorrect subclass'); + }, + [ + qr/load_namespaces found ResultSet class C with no corresponding Result class/, + qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/, + ], + 'Found warning about extra ResultSet classes, and incorrectly subclassed ResultSets', +); my $source_a = DBICNSTest->source('A'); isa_ok($source_a, 'DBIx::Class::ResultSource::Table'); diff --git a/t/72pg.t b/t/72pg.t index 542b915..738a5ff 100644 --- a/t/72pg.t +++ b/t/72pg.t @@ -146,7 +146,7 @@ for my $use_insert_returning ($test_server_supports_insert_returning } SKIP: { - skip "Need DBD::Pg 2.9.2 or newer for array tests", 4 if $DBD::Pg::VERSION < 2.009002; + skip "Need DBD::Pg 2.9.2 or newer for array tests", 5 if $DBD::Pg::VERSION < 2.009002; lives_ok { $schema->resultset('ArrayTest')->create({ @@ -160,8 +160,14 @@ for my $use_insert_returning ($test_server_supports_insert_returning }); } 'updating arrayref as pg array data'; + lives_ok { + my $row = $schema->resultset('ArrayTest')->next; + $row->arrayfield ([5, 6]); + $row->update; + } 'updating dirty arrayref as pg array data'; + $schema->resultset('ArrayTest')->create({ - arrayfield => [5, 6], + arrayfield => [7, 8], }); my $count; @@ -262,6 +268,11 @@ for my $use_insert_returning ($test_server_supports_insert_returning } } + # make sure subqueried count still works + lives_ok ( sub { + + }, 'for does not propagate on count subqueries'); + ######## other older Auto-pk tests