- Fix spurious ROLLBACK statements when a TxnScopeGuard fails a commit
of a transaction with deferred FK checks: a guard is now inactivated
immediately before the commit is attempted (RT#107159)
- - Fix spurious warning on MSSQL cursor invalidation retries (RT#102166)
- Fix the Sybase ASE storage incorrectly attempting to retrieve an
autoinc value when inserting rows containing blobs (GH#82)
- Remove spurious exception warping in ::Replicated::execute_reliably
# FIXME - we assume that $storage->{_dbh_autocommit} is there if
# txn_init_depth is there, but this is a DBI-ism
$txn_init_depth > ( $storage->{_dbh_autocommit} ? 0 : 1 )
- )
- or
- ! do {
- local $self->storage->{_in_do_block_retry_handler} = 1;
- $self->retry_handler->($self)
- }
+ ) or ! $self->retry_handler->($self)
);
# we got that far - let's retry
use mro 'c3';
use Try::Tiny;
-use DBIx::Class::_Util qw( sigwarn_silencer );
use List::Util 'first';
use namespace::clean;
my $dbh = $self->_dbh or return 0;
- try {
- local $dbh->{RaiseError} = 1;
- local $dbh->{PrintError} = 0;
+ local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
+
+ return try {
$dbh->do('select 1');
1;
- }
- catch {
- # MSSQL is *really* annoying wrt multiple active resultsets,
- # and this may very well be the reason why the _ping failed
- #
- # Proactively disconnect, while hiding annoying warnings if the case
- #
- # The callchain is:
- # < check basic retryability prerequisites (e.g. no txn) >
- # ->retry_handler
- # ->storage->connected()
- # ->ping
- # So if we got here with the in_handler bit set - we won't break
- # anything by a disconnect
- if( $self->{_in_do_block_retry_handler} ) {
- local $SIG{__WARN__} = sigwarn_silencer qr/disconnect invalidates .+? active statement/;
- $self->disconnect;
- }
-
- # RV of _ping itself
+ } catch {
0;
};
}
use Test::More;
use Test::Exception;
-use Test::Warn;
use Try::Tiny;
use DBIx::Class::Optional::Dependencies ();
ok(($new->artistid||0) > 0, "Auto-PK worked for $opts_name");
-# Test graceful error handling if not supporting multiple active statements
- if( $opts_name eq 'plain' ) {
-
- # keep the first cursor alive (as long as $rs is alive)
- my $rs = $schema->resultset("Artist");
-
- my $a1 = $rs->next;
-
- my $a2;
-
- warnings_are {
- # second cursor, invalidates $rs, but it doesn't
- # matter as long as we do not try to use it
- $a2 = $schema->resultset("Artist")->next;
- } [], 'No warning on retry due to previous cursor invalidation';
-
- is_deeply(
- { $a1->get_columns },
- { $a2->get_columns },
- 'Same data',
- );
-
- dies_ok {
- $rs->next;
- } 'Invalid cursor did not silently return garbage';
- }
-
# Test multiple active statements
- else {
+ SKIP: {
+ skip 'not a multiple active statements configuration', 1
+ if $opts_name eq 'plain';
+
$schema->storage->ensure_connected;
lives_ok {