}
unless ($self->unsafe) {
- my $weak_self = $self;
- weaken $weak_self;
- $dbh->{HandleError} = sub {
+
+ # this odd anonymous coderef dereference is in fact really
+ # necessary to avoid the unwanted effect described in perl5
+ # RT#75792
+ sub {
+ my $weak_self = $_[0];
+ weaken $weak_self;
+
+ $_[1]->{HandleError} = sub {
if ($weak_self) {
$weak_self->throw_exception("DBI Exception: $_[0]");
}
else {
# the handler may be invoked by something totally out of
# the scope of DBIC
- croak ("DBI Exception: $_[0]");
+ croak ("DBI Exception (unhandled by DBIC, ::Schema GCed): $_[0]");
}
- };
+ };
+ }->($self, $dbh);
+
$dbh->{ShowErrorStatement} = 1;
$dbh->{RaiseError} = 1;
$dbh->{PrintError} = 0;
# scope guard
my $guard = $self->txn_scope_guard;
- $self->_query_start( $sql, ['__BULK__'] );
+ $self->_query_start( $sql, [ dummy => '__BULK_INSERT__' ] );
my $sth = $self->sth($sql);
my $rv = do {
if ($empty_bind) {
}
};
- $self->_query_end( $sql, ['__BULK__'] );
+ $self->_query_end( $sql, [ dummy => '__BULK_INSERT__' ] );
$guard->commit;