[Dbix-class] Proposed patch and tests for a txn_do() method in Schema
Justin Guenther
jguenther at gmail.com
Sun Feb 26 00:32:32 CET 2006
One possible problem with failed nested rollbacks is if txn_rollback throws
an exception before resetting $self->{transaction_depth}, it mucks up with
future transactions. I've modified txn_rollback to wrap everything in an
eval{} and reset transaction_depth if it fails. Since the only thing I can
see that could throw an exception is $dbh->rollback, and it never gets
executed unless transaction_depth is 0, I don't think this is an issue but
it never hurts to be careful.
Justin Guenther
> -----Original Message-----
> From: Justin Guenther [mailto:jguenther at gmail.com]
> Sent: February 23, 2006 7:09 PM
> To: dbix-class at lists.rawmode.org
> Subject: Proposed patch and tests for a txn_do() method in Schema
>
> Hello all,
>
> Attached is a patch that I've worked out with the help of the
> good people of #dbix-class. Its changes include:
>
> - Added DBIx::Class::Storage class, with virtual methods that
> DBIx::Class::Storage::DBI redefines
> - Made DBIx::Class::Storage::DBI a subclass of DBIx::Class::Storage
> - Added an exception class
> DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION, which helps
> DBIx::Class::Schema::txn_do() differentiate between a nested
> rollback being propagated and a rollback failing.
> - Added tests for txn_do(), including successful transactions
> returning values in both scalar and list context, successful
> nested transactions, failed transactions (both nested and
> not) and failed transactions with a failed rollback
>
> Comments? Suggestions? Anything I've missed as far as being
> exception-safe is concerned?
>
>
> Justin Guenther
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: txn_do.patch
Type: application/octet-stream
Size: 10441 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060225/10731a45/attachment-0001.obj
More information about the Dbix-class
mailing list