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

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Wed Jan 14 01:25:29 GMT 2009


Author: caelum
Date: 2009-01-14 01:25:28 +0000 (Wed, 14 Jan 2009)
New Revision: 5307

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
Log:
auto_savepoint support for Oracle and a note on txn_do for with "AutoCommit => 0"


Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm	2009-01-13 02:46:28 UTC (rev 5306)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm	2009-01-14 01:25:28 UTC (rev 5307)
@@ -573,6 +573,14 @@
 This interface is preferred over using the individual methods L</txn_begin>,
 L</txn_commit>, and L</txn_rollback> below.
 
+WARNING: If you are connected with C<AutoCommit => 0> the transaction is
+considered nested, and you will still need to call L</txn_commit> to write your
+changes when appropriate. You will also want to connect with C<auto_savepoint =>
+1> to get partial rollback to work, if the storage driver for your database
+supports it.
+
+Connecting with C<AutoCommit => 1> is recommended.
+
 =cut
 
 sub txn_do {

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2009-01-13 02:46:28 UTC (rev 5306)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2009-01-14 01:25:28 UTC (rev 5307)
@@ -103,6 +103,22 @@
 
 sub datetime_parser_type { return "DateTime::Format::Oracle"; }
 
+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 }
+
+sub _svp_rollback {
+    my ($self, $name) = @_;
+
+    $self->dbh->do("ROLLBACK TO SAVEPOINT $name")
+}
+
 =head1 AUTHORS
 
 Andy Grundman <andy at hybridized.org>

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle.pm	2009-01-13 02:46:28 UTC (rev 5306)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle.pm	2009-01-14 01:25:28 UTC (rev 5307)
@@ -25,20 +25,6 @@
     }
 }
 
-sub _svp_begin {
-    my ($self, $name) = @_;
- 
-    $self->dbh->do("SAVEPOINT $name");
-}
-
-# Would've implemented _svp_release here, but Oracle doesn't support it.
-
-sub _svp_rollback {
-    my ($self, $name) = @_;
-
-    $self->dbh->do("ROLLBACK TO SAVEPOINT $name")
-}
-
 1;
 
 =head1 NAME

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class.pm	2009-01-13 02:46:28 UTC (rev 5306)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class.pm	2009-01-14 01:25:28 UTC (rev 5307)
@@ -217,6 +217,8 @@
 
 bricas: Brian Cassidy <bricas at cpan.org>
 
+caelum: Rafael Kitover <rkitover at cpan.org>
+
 captainL: Luke Saunders <luke.saunders at gmail.com>
 
 castaway: Jess Robinson




More information about the Bast-commits mailing list