$self->_dbh->do('SET CHAINED ON');
}
}
-
- $self->_insert_dbh($self->_connect(@{ $self->_dbi_connect_info }));
}
=head2 connect_call_blob_setup
if (
$need_last_insert_id && !$self->unsafe_insert && !$self->{transaction_depth}
) {
+ $self->_insert_dbh($self->_connect(@{ $self->_dbi_connect_info }))
+ unless $self->_insert_dbh;
local $self->{_dbh} = $self->_insert_dbh;
my $guard = $self->txn_scope_guard;
my $upd_cols = $self->next::method (@_);
$guard->commit;
+ $self->_insert_dbh($self->_dbh);
$upd_cols;
}
else {
L<reset|DBIx::Class::ResultSet/reset>.
Transactions done for inserts in C<AutoCommit> mode when placeholders are in use
-are also affected, so this won't work:
-
- while (my $row = $rs1->next) {
- $rs2->create({ foo => $row->foo });
- }
+are not affected, as they use an extra database handle to do the insert.
Some workarounds:
=over 4
-=item * set C<< $schema->storage->unsafe_insert(1) >> temporarily (see
-L</connect_call_unsafe_insert>)
-
=item * use L<DBIx::Class::Storage::DBI::Replicated>
=item * L<connect|DBIx::Class::Schema/connect> another L<Schema|DBIx::Class::Schema>