lib/DBIx/Class/ResultSourceProxy/Table.pm
lib/DBIx/Class/Row.pm
lib/DBIx/Class/Schema.pm
-lib/DBIx/Class/Serialize.pm
+lib/DBIx/Class/Serialize/Storable.pm
lib/DBIx/Class/Storage/DBI.pm
lib/DBIx/Class/Storage/DBI/Cursor.pm
+lib/DBIx/Class/Storage/DBI/DB2.pm
+lib/DBIx/Class/Storage/DBI/MSSQL.pm
+lib/DBIx/Class/Storage/DBI/mysql.pm
+lib/DBIx/Class/Storage/DBI/Oracle.pm
+lib/DBIx/Class/Storage/DBI/Pg.pm
+lib/DBIx/Class/Storage/DBI/SQLite.pm
lib/DBIx/Class/Test/SQLite.pm
lib/DBIx/Class/UUIDColumns.pm
+lib/DBIx/Class/UUIDMaker.pm
+lib/DBIx/Class/UUIDMaker/APR/UUID.pm
+lib/DBIx/Class/UUIDMaker/Data/Uniqid.pm
+lib/DBIx/Class/UUIDMaker/Data/UUID.pm
+lib/DBIx/Class/UUIDMaker/UUID.pm
+lib/DBIx/Class/UUIDMaker/Win32/Guidgen.pm
+lib/DBIx/Class/UUIDMaker/Win32API/GUID.pm
lib/DBIx/Class/Validation.pm
lib/SQL/Translator/Parser/DBIx/Class.pm
lib/SQL/Translator/Producer/DBIx/Class/File.pm
Makefile.PL
MANIFEST This list of files
-META.yml
README
t/02pod.t
t/03podcoverage.t.disabled
t/basicrels/11mysql.t
t/basicrels/12pg.t
t/basicrels/13oracle.t
+t/basicrels/145db2.t
t/basicrels/14mssql.t
t/basicrels/15limit.t
t/basicrels/16joins.t
t/basicrels/17join_count.t
t/basicrels/18self_referencial.t
t/basicrels/19uuid.t
+t/basicrels/20unique.t
+t/basicrels/21serialize.t
t/cdbi-sweet-t/08pager.t
t/cdbi-t/01-columns.t
t/cdbi-t/02-Film.t
t/helperrels/11mysql.t
t/helperrels/12pg.t
t/helperrels/13oracle.t
+t/helperrels/145db2.t
t/helperrels/14mssql.t
t/helperrels/15limit.t
t/helperrels/16joins.t
t/helperrels/18self_referencial.t
t/helperrels/19uuid.t
t/helperrels/20unique.t
+t/helperrels/21serialize.t
t/lib/DBICTest.pm
t/lib/DBICTest/BasicRels.pm
t/lib/DBICTest/Extra.pm
t/run/11mysql.tl
t/run/12pg.tl
t/run/13oracle.tl
+t/run/145db2.tl
t/run/14mssql.tl
t/run/15limit.tl
t/run/16joins.tl
t/run/18self_referencial.tl
t/run/19uuid.tl
t/run/20unique.tl
+t/run/21serialize.tl
t/testlib/Actor.pm
t/testlib/ActorAlias.pm
t/testlib/Binary.pm
t/testlib/Order.pm
t/testlib/OtherFilm.pm
t/testlib/PgBase.pm
+META.yml
PRE: foreach my $pre (keys %{$prefetch||{}}) {
my $pre_source = $source->related_source($pre);
$class->throw_exception("Can't prefetch non-existant relationship ${pre}") unless $pre_source;
- my $fetched = $pre_source->result_class->inflate_result(
- $pre_source, @{$prefetch->{$pre}});
+ my $fetched;
+ unless ($pre_source->primary_columns == grep { exists $prefetch->{$pre}[0]{$_}
+ and !defined $prefetch->{$pre}[0]{$_} } $pre_source->primary_columns)
+ {
+ $fetched = $pre_source->result_class->inflate_result(
+ $pre_source, @{$prefetch->{$pre}});
+ }
my $accessor = $source->relationship_info($pre)->{attrs}{accessor};
$class->throw_exception("No accessor for prefetched $pre")
unless defined $accessor;
- PRIMARY: foreach my $pri ($pre_source->primary_columns) {
- unless (defined $fetched->get_column($pri)) {
- undef $fetched;
- last PRIMARY;
- }
- }
if ($accessor eq 'single') {
$new->{_relationship_data}{$pre} = $fetched;
} elsif ($accessor eq 'filter') {
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 40 );
+ : ( tests => 41 );
}
# test the abstract join => SQL generator
unlink 't/var/dbic.trace';
is($selects, 1, 'prefetch ran only 1 select statement');
+# test for partial prefetch via cols attr
+my $cd = $schema->resultset('CD')->find(1,
+ {
+ cols => [qw/title artist.name/],
+ join => 'artist'
+ }
+);
+ok(eval { $cd->artist->name eq 'Caterwauler McCrae' }, 'single related column prefetched');
+
# start test for nested prefetch SELECT count
unlink 't/var/dbic.trace' if -e 't/var/dbic.trace';
DBI->trace(1, 't/var/dbic.trace');
unlink 't/var/dbic.trace' if -e 't/var/dbic.trace';
DBI->trace(1, 't/var/dbic.trace');
-my $cd = $schema->resultset('CD')->find(1, { prefetch => 'artist' });
+$cd = $schema->resultset('CD')->find(1, { prefetch => 'artist' });
is($cd->{_inflated_column}{artist}->name, 'Caterwauler McCrae', 'artist prefetched correctly on find');