2010年2月11日星期四

Re: [fw-db] question about transactions - application or db layer?

Hello ,

Sam Sandberg schrieb:

>
> I am curious about controlling my database transactions using a
> commit/rollback strategy.


there is this "Unit-Of-Work" pattern -
http://martinfowler.com/eaaCatalog/unitOfWork.html
has anyone used this so far ?

The question of when/how to commit arises for me in this uses case:

An operation in the model needs to use a transaction, is atomic.
Another operation, to the outside also atomic , calls the 1st operation,
amongst other things.. Now, where to place the transaction start/end ,
if both operations can be called independently .. ?

> If there are several connections making
> changes to the same database, are their commit modes affected?


The transactions are handled through the adapter in ZF:
( $adapter->beginTransaction(); ... $adapter->commit(); )
Different connections (adapter instances) should have independent
transactions


regards , matthias

>
> I am using MySQL using the pdo_mysql PHP extension.
>
> Thanks,
>
> -Sam
>
> --
> Sam Sandberg
>
>
> "Well, nothing goes better with cabbage than cabbage."
> -Mrs. Bucket

没有评论: