develooper Front page | perl.perl6.language | Postings from July 2005

Database Transactions and STM [was: Re: STM semantics, the Transactionalrole]

Thread Previous | Thread Next
From:
Sam Vilain
Date:
July 17, 2005 20:16
Subject:
Database Transactions and STM [was: Re: STM semantics, the Transactionalrole]
Message ID:
42DB1F00.2080406@vilain.net
Yuval Kogman wrote:
> everyone gets to choose, and another thing I have in mind is the
> Transactional role...
> 	DBI::Handle does Transactional;
> To the STM rollbacker and type checker thingy this means that any IO
> performed by DBI::Handle invoked code is OK - it can be reversed
> using the Transactional interface it proposes.

Is this needed, when you can just;

   atomic {
      unsafeIO { $dbh.begin_work };

      unsafeIO { $dbh.do(...) };

      unsafeIO { $dbh.commit };
   } CATCH {
      $dbh.rollback;
   };

Of course, these unsafeIO calls can go inside a higher level wrapper
for the DBI, assuming that it is possible to detect whether or not
we are running in an atomic{ }, and "which" atomic block we are in.

As for the efficiency of things, hate to say it but that's really up
to the backend in use, and it's highly unlikely that anything other
than Parrot or GHC will support atomic{ }.

However a standard Role for this kind of behaviour might make sense.
Maybe draw up a prototype?

Sam.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About