[Bast-commits] r7849 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI/Sybase

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Tue Nov 10 12:16:18 GMT 2009


Author: caelum
Date: 2009-11-10 12:16:18 +0000 (Tue, 10 Nov 2009)
New Revision: 7849

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
Log:
made commit/rollback when disconnected an exception

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2009-11-09 23:12:58 UTC (rev 7848)
+++ DBIx-Class/0.08/trunk/Changes	2009-11-10 12:16:18 UTC (rev 7849)
@@ -23,6 +23,7 @@
         - Fixed another lingering problem with PostgreSQL
           auto-increment support and its interaction with multiple
           schemas
+        - Transaction support for MSSQL via DBD::Sybase
 
 0.08112 2009-09-21 10:57:00 (UTC)
         - Remove the recommends from Makefile.PL, DBIx::Class is not

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-11-09 23:12:58 UTC (rev 7848)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-11-10 12:16:18 UTC (rev 7849)
@@ -37,14 +37,16 @@
 
 sub _dbh_commit {
   my $self = shift;
-
-  $self->_dbh->do('COMMIT');
+  my $dbh  = $self->_dbh
+    or $self->throw_exception('cannot COMMIT on a disconnected handle');
+  $dbh->do('COMMIT');
 }
 
 sub _dbh_rollback {
   my $self = shift;
-
-  $self->_dbh->do('ROLLBACK');
+  my $dbh  = $self->_dbh
+    or $self->throw_exception('cannot ROLLBACK on a disconnected handle');
+  $dbh->do('ROLLBACK');
 }
 
 1;

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-11-09 23:12:58 UTC (rev 7848)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-11-10 12:16:18 UTC (rev 7849)
@@ -1145,7 +1145,6 @@
 sub txn_commit {
   my $self = shift;
   if ($self->{transaction_depth} == 1) {
-    my $dbh = $self->_dbh;
     $self->debugobj->txn_commit()
       if ($self->debug);
     $self->_dbh_commit;
@@ -1161,7 +1160,9 @@
 
 sub _dbh_commit {
   my $self = shift;
-  $self->_dbh->commit;
+  my $dbh  = $self->_dbh
+    or $self->throw_exception('cannot COMMIT on a disconnected handle');
+  $dbh->commit;
 }
 
 sub txn_rollback {
@@ -1198,7 +1199,9 @@
 
 sub _dbh_rollback {
   my $self = shift;
-  $self->_dbh->rollback;
+  my $dbh  = $self->_dbh
+    or $self->throw_exception('cannot ROLLBACK on a disconnected handle');
+  $dbh->rollback;
 }
 
 # This used to be the top-half of _execute.  It was split out to make it




More information about the Bast-commits mailing list