Revision history for DBIx::Class
+ - throw a clear exception when user tries multi-has_many prefetch
+ - SQLT parser prefixes index names with ${table}_idx_ to avoid clashes
- mark ResultSetManager as deprecated and undocument it
- pod fix (RT #32988)
- add Test::Exception to test requirements (RT #34256)
$self->throw_exception(
"Can't prefetch has_many ${pre} (join cond too complex)")
unless ref($rel_info->{cond}) eq 'HASH';
+ my $dots = @{[$as_prefix =~ m/\./g]} + 1; # +1 to match the ".${as_prefix}"
+ if (my ($fail) = grep { @{[$_ =~ m/\./g]} == $dots }
+ keys %{$collapse}) {
+ my ($last) = ($fail =~ /([^\.]+)$/);
+ $self->throw_exception(
+ "Can't prefetch multiple has_many rels ${last} and ${pre}"
+ .(length($as_prefix) ? "at the same level (${as_prefix})"
+ : "at top level"
+ ));
+ }
#my @col = map { (/^self\.(.+)$/ ? ("${as_prefix}.$1") : ()); }
# values %{$rel_info->{cond}};
$collapse->{".${as_prefix}${pre}"} = [ $rel_source->primary_columns ];
'DBIx::Class::Relationship::ManyToMany' => { skip => 1 },
'DBIx::Class::Relationship::ProxyMethods' => { skip => 1 },
'DBIx::Class::ResultSetProxy' => { skip => 1 },
+ 'DBIx::Class::ResultSetManager' => { skip => 1 },
'DBIx::Class::ResultSourceProxy' => { skip => 1 },
'DBIx::Class::Storage::DBI' => { skip => 1 },
'DBIx::Class::Storage::DBI::DB2' => { skip => 1 },
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 58 );
+ : ( tests => 50 );
}
# figure out if we've got a version of sqlite that is older than 3.2.6, in
# once the following TODO is complete, remove the 2 stop-gap tests immediately after the TODO block
# (the TODO block itself contains tests ensuring that the stop-gaps are removed)
-TODO: {
+TODO: if (0) { # broken-ass todo block commented out by mst
local $TODO = 'Prefetch of multiple has_many rels at the same level (currently must die to protect the clueless git)';
use DBIx::Class::ResultClass::HashRefInflator;