[Bast-commits] r7443 -
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sun Aug 30 16:19:48 GMT 2009
Author: caelum
Date: 2009-08-30 16:19:46 +0000 (Sun, 30 Aug 2009)
New Revision: 7443
Modified:
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
added txn_scope_guards for blob operations
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-08-30 07:53:38 UTC (rev 7442)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-08-30 16:19:46 UTC (rev 7443)
@@ -289,13 +289,16 @@
sub last_insert_id { shift->_identity }
-# override to handle TEXT/IMAGE and to do a transaction if necessary
+# handles TEXT/IMAGE and transaction for last_insert_id
sub insert {
my $self = shift;
my ($source, $to_insert) = @_;
my $blob_cols = $self->_remove_blob_cols($source, $to_insert);
+# insert+blob insert done atomically
+ my $guard = $self->txn_scope_guard if %$blob_cols;
+
my $need_last_insert_id = 0;
my ($identity_col) =
@@ -324,6 +327,8 @@
$self->_insert_blobs($source, $blob_cols, $to_insert) if %$blob_cols;
+ $guard->commit if $guard;
+
return $updated_cols;
}
@@ -335,6 +340,9 @@
my $blob_cols = $self->_remove_blob_cols($source, $fields);
+# update+blob update(s) done atomically
+ my $guard = $self->txn_scope_guard if %$blob_cols;
+
my @res;
if ($wantarray) {
@res = $self->next::method(@_);
@@ -348,6 +356,8 @@
$self->_update_blobs($source, $blob_cols, $where) if %$blob_cols;
+ $guard->commit if %$blob_cols;
+
return $wantarray ? @res : $res[0];
}
More information about the Bast-commits
mailing list