[Bast-commits] r7599 -
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon Sep 7 19:31:38 GMT 2009
Author: caelum
Date: 2009-09-07 19:31:38 +0000 (Mon, 07 Sep 2009)
New Revision: 7599
Modified:
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
fix _insert_dbh code to only connect when needed, doc update
Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-09-07 14:46:14 UTC (rev 7598)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-09-07 19:31:38 UTC (rev 7599)
@@ -129,8 +129,6 @@
$self->_dbh->do('SET CHAINED ON');
}
}
-
- $self->_insert_dbh($self->_connect(@{ $self->_dbi_connect_info }));
}
=head2 connect_call_blob_setup
@@ -314,10 +312,13 @@
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 {
@@ -621,19 +622,12 @@
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:
+are not affected, as they use an extra database handle to do the insert.
- while (my $row = $rs1->next) {
- $rs2->create({ foo => $row->foo });
- }
-
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>
More information about the Bast-commits
mailing list