X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=de373aa286451d47374fa4c69e00222db95bca69;hb=adb3554a3f72bf9c9b267c5eb84a8401da64bf37;hp=64a0f04c345e56f4c0704fb5628495914c89db10;hpb=c64db0f42b79d76153064d3226d4f30a606ef893;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 64a0f04..de373aa 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -867,6 +867,59 @@ sub _connect { $dbh; } +sub svp_begin { + my ($self, $name) = @_; + + $self->throw_exception("You failed to provide a savepoint name!") if !$name; + + if($self->{transaction_depth} == 0) { + warn("Can't use savepoints without a transaction."); + return 0; + } + + if(!$self->can('_svp_begin')) { + warn("Your Storage implementation doesn't support savepoints!"); + return 0; + } + $self->debugobj->svp_begin($name) if $self->debug; + $self->_svp_begin($self->dbh(), $name); +} + +sub svp_release { + my ($self, $name) = @_; + + $self->throw_exception("You failed to provide a savepoint name!") if !$name; + + if($self->{transaction_depth} == 0) { + warn("Can't use savepoints without a transaction."); + return 0; + } + + if(!$self->can('_svp_release')) { + warn("Your Storage implementation doesn't support savepoint releasing!"); + return 0; + } + $self->debugobj->svp_release($name) if $self->debug; + $self->_svp_release($self->dbh(), $name); +} + +sub svp_rollback { + my ($self, $name) = @_; + + $self->throw_exception("You failed to provide a savepoint name!") if !$name; + + if($self->{transaction_depth} == 0) { + warn("Can't use savepoints without a transaction."); + return 0; + } + + if(!$self->can('_svp_rollback')) { + warn("Your Storage implementation doesn't support savepoints!"); + return 0; + } + $self->debugobj->svp_rollback($name) if $self->debug; + $self->_svp_rollback($self->dbh(), $name); +} sub txn_begin { my $self = shift;