From: Rafael Kitover Date: Wed, 14 Jan 2009 01:25:28 +0000 (+0000) Subject: auto_savepoint support for Oracle and a note on txn_do for with "AutoCommit => 0" X-Git-Tag: v0.08240~194 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=281719d262c5f565901fd017b6f3c12030de81e4;p=dbsrgits%2FDBIx-Class.git auto_savepoint support for Oracle and a note on txn_do for with "AutoCommit => 0" --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 0d10c8c..190ec4a 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -217,6 +217,8 @@ bluefeet: Aran Deltac bricas: Brian Cassidy +caelum: Rafael Kitover + captainL: Luke Saunders castaway: Jess Robinson diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 102e259..e58fbf2 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -573,6 +573,14 @@ See L for more information. This interface is preferred over using the individual methods L, L, and L below. +WARNING: If you are connected with C 0> the transaction is +considered nested, and you will still need to call L to write your +changes when appropriate. You will also want to connect with C +1> to get partial rollback to work, if the storage driver for your database +supports it. + +Connecting with C 1> is recommended. + =cut sub txn_do { diff --git a/lib/DBIx/Class/Storage/DBI/Oracle.pm b/lib/DBIx/Class/Storage/DBI/Oracle.pm index 64bf9f1..29bfce1 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle.pm @@ -25,20 +25,6 @@ sub _rebless { } } -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 diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 5fbd994..3861cdd 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -103,6 +103,22 @@ L. 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