[Dbix-class] transactions, etc.

Josef Karthauser joe at tao.org.uk
Wed Jan 24 15:36:59 GMT 2007


Hi Matt,

Thoughts about transactions if I may.

Firstly things look a bit gnarly with respect to auto re-connection,
and forking (validate_pid).  It doesn't look as if any transaction
rules are in place for these operations, which means that things
can get out of sync.  If the database connection really needs to
be reopened then a check ought to be made to see if the application
thinks that a transaction is currently in process.  If it does then
it needs to be delivered a signal probably, as at that point all
bets are off.  Same also if the process has forked, although that
case looks like it might be dealt with automatically if the first
case is resolved.

Assuming that all this is ok, what about database dependant transaction
handling?  It looks like we want to support the possibility of a
txn_begin(), txn_rollback() and txn_commit() in each
DBIC::Storage::DBI::driver module and have the one in ...:DBI.pm
call that if it exists.  Do you have any preferences as to how this
should happen?

Also, do you have any idea why when I run this:

    #!/usr/bin/perl                                                             

    use Tao::DBIx;
 
    my $schema = Tao::DBIx->schema("root","qpqpqp");
 
    $schema->txn_begin();
    print "A\n";
    $schema->txn_begin();
    print "A2\n";
    $schema->txn_rollback();
    print "R2\n";
    $schema->txn_rollback();
    print "R3\n";

I only get this as output:

    A
    A2

I know it's because the rollback is returning a nested rollback
exception, which I'm not catching, but why aren't I getting a croaked
warning as it dies?

Joe
-- 
=== Josef Karthauser (joe at tao.org.uk) === http://x2obuilder.com/tao ===
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070124/601f3578/attachment.pgp


More information about the Dbix-class mailing list