turn on ib_softcommit, savepoint tests now pass for DBD::InterBase
Rafael Kitover [Wed, 10 Feb 2010 12:42:17 +0000 (12:42 +0000)]
lib/DBIx/Class/Storage/DBI/InterBase.pm
lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm
t/750firebird.t

index 2908519..5f9e799 100644 (file)
@@ -163,6 +163,15 @@ sub _set_sql_dialect {
   }
 }
 
+# softcommit makes savepoints work
+sub _run_connection_actions {
+  my $self = shift;
+
+  $self->_dbh->{ib_softcommit} = 1;
+
+  $self->next::method(@_);
+}
+
 =head2 connect_call_datetime_setup
 
 Used as:
index 16f0ec9..11af658 100644 (file)
@@ -47,9 +47,15 @@ sub _set_sql_dialect { 1 }
 
 =head1 CAVEATS
 
+=over 4
+
+=item *
+
 This driver (unlike L<DBD::InterBase>) does not currently support reading or
 writing C<TIMESTAMP> values with sub-second precision.
 
+=back
+
 =head1 AUTHOR
 
 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
index 981da1e..49f30c9 100644 (file)
@@ -68,22 +68,22 @@ EOF
   ok($new->artistid, "Auto-PK worked");
 
 # test savepoints
-#  eval {
-#    $schema->txn_do(sub {
-#      eval {
-#        $schema->txn_do(sub {
-#          $ars->create({ name => 'in_savepoint' });
-#          die "rolling back savepoint";
-#        });
-#      };
-#      ok ((not $ars->search({ name => 'in_savepoint' })->first),
-#        'savepoint rolled back');
-#      $ars->create({ name => 'in_outer_txn' });
-#      die "rolling back outer txn";
-#    });
-#  };
-#  ok ((not $ars->search({ name => 'in_outer_txn' })->first),
-#    'outer txn rolled back');
+  eval {
+    $schema->txn_do(sub {
+      eval {
+        $schema->txn_do(sub {
+          $ars->create({ name => 'in_savepoint' });
+          die "rolling back savepoint";
+        });
+      };
+      ok ((not $ars->search({ name => 'in_savepoint' })->first),
+        'savepoint rolled back');
+      $ars->create({ name => 'in_outer_txn' });
+      die "rolling back outer txn";
+    });
+  };
+  ok ((not $ars->search({ name => 'in_outer_txn' })->first),
+    'outer txn rolled back');
 
 # test explicit key spec
   $new = $ars->create ({ name => 'bar', artistid => 66 });