Grumble - this was such a simple thing to diagnose and it took a month to
see it. The culprit was the (correctly bisected to) cleanup in
d87929a4,
which failed to take into account that an empty connect() can still lead
to a healthy $dbh, given system-based authoriozation, and no attributes
being passed in.
For the curious - the difficulty to diagnose was further exacerbated by
the apparent insanity of what was being generated - a (known, existing)
method name was somehow leaking into the generated SQL. In reality when
we failed to determine the driver, we also failed to determine the SQLA
subclass, which in turn made us call a nonexisting method on $sql_maker,
but *surprise* - SQL::Abstract (the granddady of it all) defines an
AUTOLOAD. Kh
aaaaaaaaaaaaa....
my $alias = $self->next::method(@_);
# we need to shorten here in addition to the shortening in SQLA itself,
- # since the final relnames are a crucial for the join optimizer
+ # since the final relnames are crucial for the join optimizer
return $self->sql_maker->_shorten_identifier($alias);
}
do_clean ($dbh2);
}}
+# test driver determination issues that led to the diagnosis/fix in 37b5ab51
+# observed side-effect when count-is-first on a fresh env-based connect
+ {
+ local $ENV{DBI_DSN};
+ ($ENV{DBI_DSN}, my @user_pass_args) = @{ $schema->storage->connect_info };
+ my $s2 = DBICTest::Schema->connect( undef, @user_pass_args );
+ ok (! $s2->storage->connected, 'Not connected' );
+ is (ref $s2->storage, 'DBIx::Class::Storage::DBI', 'Undetermined driver' );
+
+ ok (
+ $s2->resultset('Artist')->search({ 'me.name' => { like => '%' } }, { prefetch => 'cds' })->count,
+ 'Some artist count'
+ );
+ ok (
+ scalar $s2->resultset('CD')->search({}, { join => 'tracks' } )->all,
+ 'Some cds returned'
+ );
+ $s2->storage->disconnect;
+ }
+
do_clean ($dbh);
}