From: Rafael Kitover Date: Fri, 24 Jul 2009 14:19:08 +0000 (+0000) Subject: savepoint support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1816be4f51709d94945380c0a65de80e5606b162;p=dbsrgits%2FDBIx-Class-Historic.git savepoint support --- diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 9c50a3c..925d7f9 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -209,12 +209,6 @@ sub connect_call_datetime_setup { "alter session set nls_timestamp_tz_format='$timestamp_tz_format'"); } -sub _svp_begin { - my ($self, $name) = @_; - - $self->dbh->do("SAVEPOINT $name"); -} - =head2 source_bind_attributes Handle LOB types in Oracle. Under a certain size (4k?), you can get away @@ -257,6 +251,12 @@ sub source_bind_attributes return \%bind_attributes; } +sub _svp_begin { + my ($self, $name) = @_; + + $self->dbh->do("SAVEPOINT $name"); +} + # Oracle automatically releases a savepoint when you start another one with the # same name. sub _svp_release { 1 } diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index e67f1ca..ef4616c 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -192,9 +192,7 @@ sub insert { my $updated_cols = $self->next::method($source, $to_insert, @_); - if ($identity_insert) { - $dbh->do("SET IDENTITY_INSERT $table OFF"); - } + $dbh->do("SET IDENTITY_INSERT $table OFF") if $identity_insert; $self->_insert_blobs($source, $blob_cols, $to_insert) if %$blob_cols; @@ -388,6 +386,23 @@ sub _dbh_last_insert_id { return $id; } +# savepoint support using ASE syntax + +sub _svp_begin { + my ($self, $name) = @_; + + $self->dbh->do("SAVE TRANSACTION $name"); +} + +# A new SAVE TRANSACTION with the same name releases the previous one. +sub _svp_release { 1 } + +sub _svp_rollback { + my ($self, $name) = @_; + + $self->dbh->do("ROLLBACK TRANSACTION $name"); +} + 1; =head1 MAXIMUM CONNECTIONS