[Bast-commits] r7114 - in DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI: . Oracle

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Fri Jul 24 14:19:08 GMT 2009


Author: caelum
Date: 2009-07-24 14:19:08 +0000 (Fri, 24 Jul 2009)
New Revision: 7114

Modified:
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
savepoint support

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2009-07-24 08:04:00 UTC (rev 7113)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2009-07-24 14:19:08 UTC (rev 7114)
@@ -209,12 +209,6 @@
 "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 @@
 	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 }

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-07-24 08:04:00 UTC (rev 7113)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-07-24 14:19:08 UTC (rev 7114)
@@ -192,9 +192,7 @@
 
   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 @@
   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




More information about the Bast-commits mailing list