Revision history for DBIx::Class
+ * Fixes
+ - Work around unreliable $sth->finish() on INSERT ... RETURNING within
+ DBD::Firebird on some compiler/driver combinations (RT#110979)
+
0.082821 2016-02-11 17:58 (UTC)
* Fixes
- Fix t/52leaks.t failures on compilerless systems (RT#104429)
my %returned_cols = %$to_insert;
if (my $retlist = $sqla_opts->{returning}) { # if IR is supported - we will get everything in one set
- @ir_container = try {
- local $SIG{__WARN__} = sub {};
- my @r = $sth->fetchrow_array;
- $sth->finish;
- @r;
- } unless @ir_container;
+
+ unless( @ir_container ) {
+ try {
+
+ # FIXME - need to investigate why Caelum silenced this in 4d4dc518
+ local $SIG{__WARN__} = sub {};
+
+ @ir_container = $sth->fetchrow_array;
+ $sth->finish;
+
+ } catch {
+ # Evict the $sth from the cache in case we got here, since the finish()
+ # is crucial, at least on older Firebirds, possibly on other engines too
+ #
+ # It would be too complex to make this a proper subclass override,
+ # and besides we already take the try{} penalty, adding a catch that
+ # triggers infrequently is a no-brainer
+ #
+ if( my $kids = $self->_dbh->{CachedKids} ) {
+ $kids->{$_} == $sth and delete $kids->{$_}
+ for keys %$kids
+ }
+ };
+ }
@returned_cols{@$retlist} = @ir_container if @ir_container;
}
use Test::Exception;
use DBIx::Class::Optional::Dependencies ();
use Scope::Guard ();
+use List::Util 'shuffle';
use Try::Tiny;
use lib qw(t/lib);
use DBICTest;
my $schema;
-my @test_order = map { "DBICTEST_FIREBIRD$_" }
- DBICTest::RunMode->is_plain
- ? ('', '_INTERBASE', '_ODBC') # Least likely to fail
- : ('_ODBC', '_INTERBASE' , ''); # Most likely to fail
+for my $prefix (shuffle keys %$env2optdep) { SKIP: {
-for my $prefix (@test_order) { SKIP: {
+ skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1)
+ unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix});
my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/;
- next unless $dsn;
-
note "Testing with ${prefix}_DSN";
- skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1)
- unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix});
-
- skip ("DBD::InterBase crashes if Firebird or ODBC are also loaded", 1)
- if $prefix eq 'DBICTEST_FIREBIRD_INTERBASE' and
- ($ENV{DBICTEST_FIREBIRD_DSN} or $ENV{DBICTEST_FIREBIRD_ODBC_DSN});
-
$schema = DBICTest::Schema->connect($dsn, $user, $pass, {
auto_savepoint => 1,
quote_names => 1,