Skip Menu |

This queue is for tickets about the Rose-DB CPAN distribution.

Report information
The Basics
Id: 73727
Status: resolved
Priority: 0/
Queue: Rose-DB

People
Owner: Nobody in particular
Requestors: KOORCHIK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Hello, John! I like Rose::DB very much but I wish to have one more feature. There is a very convinient "do_transaction" method but it does not support nested transaction. I'd like to have "nest_transaction" method which will be the same as "do_transaction" but will not create new transaction if one is already started and will throw exception on error; This code $db->nest_transaction(sub { $db->do('UPDATE...'); #Outer update $db->nest_transaction(sub { $db->do('UPDATE...'); #Inner update }); }) will be instead of my $udpate_sub_outer = sub { $db->do('UPDATE...'); # Outer update my $update_sub_inner = sub { $db->do('UPDATE...'); # Inner update } if ( $db->in_transaction ) { $update_sub_inner->(); } else { $db->do_transaction($udpate_sub_inner) or die $db->error; } }; if ( $db->in_transaction ) { $udpate_sub_outer->(); } else { $db->do_transaction($udpate_sub_outer) or die $db->error; }
Hello, John. What do you think about this feature? Can I hope that the feature will be implemented?
Hello, John. You can just close this ticket. I've implemented this functionality as separeate role - https://metacpan.org/module/Rose::DBx::Role::NestTransaction