X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=604ad5b7e8ed936799f5caaf2c35914dfd826fb4;hb=27a46182277b5b6c1f08174c9533d4a9657f9ee5;hp=1895ab4c852af82bad45ba361431ed4d6b966152;hpb=ddf66ced51e4cb9b888001bc926bc0b3c3af0f8b;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 1895ab4..604ad5b 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -264,10 +264,10 @@ sub txn_rollback { die "Virtual method!" } =head2 svp_begin -Arguments: $savepoint_name +Arguments: $savepoint_name? -Establishes a new savepoint of the specified name within the current -transaction. +Created a new savepoint using the name provided as argument. If no name +is provided, a random name will be used. =cut @@ -275,10 +275,11 @@ sub svp_begin { die "Virtual method!" } =head2 svp_release -Arguments: $savepoint_name +Arguments: $savepoint_name? -Destroy a savepoint, but keep the effects of the commands executed since -it's creation. +Release the savepoint provided as argument. If none is provided, +release the savepoint created most recently. This will implicitly +release all savepoints created after the one explicitly released as well. =cut @@ -286,28 +287,33 @@ sub svp_release { die "Virtual method!" } =head2 svp_rollback -Arguments: $savepoint_name +Arguments: $savepoint_name? -Rollback to the savepoint of the specified name. +Rollback to the savepoint provided as argument. If none is provided, +rollback to the savepoint created most recently. This will implicitly +release all savepoints created after the savepoint we rollback to. =cut sub svp_rollback { die "Virtual method!" } -=head2 svp_generate_name +=for comment -Generates a name for the next savepoint. Defaults to 'savepoint_$count', -where count is the number of current savepoints + 1. +=head2 txn_scope_guard (EXPERIMENTAL) -=cut +An alternative way of using transactions to C: -sub svp_generate_name { die "Virtual method!" } + my $txn = $storage->txn_scope_guard; -=for comment + $row->col1("val1"); + $row->update; -=head2 txn_scope_guard + $txn->commit; -Return an object that does stuff. +If a exception occurs, the transaction will be rolled back. This is still very +experiemental, and we are not 100% sure it is working right when nested. The +onus is on you as the user to make sure you dont forget to call +$C<$txn->commit>. =cut @@ -475,7 +481,8 @@ Old name for DBIC_TRACE =head1 SEE ALSO -L - reference storage inplementation using SQL::Abstract and DBI. +L - reference storage implementation using +SQL::Abstract and DBI. =head1 AUTHORS