[TYPO3-dev] Idea: add transaction support to t3lib_db

Dmitry Dulepov dmitry.dulepov at gmail.com
Mon Mar 7 10:02:48 CET 2011


Hi!

Christian Futterlieb wrote:
> a) it is irritating, when a transaction could be started/committed, but
> in fact at this point it has no effect on the database (except no
> transaction was started before). Furthermore it may be never committed
> when another independent code segment rolls back the transaction.

That's the point of transaction: to keep database state consistent. If the 
transaction needs to be rolled back, that's for a reason. Would you prefer 
only half-data in the database? Surely not.

> b) it is the developers responsibility to do not nest transactions. If
> one tries to start a transaction and gets the error, he should know that
> the transaction is not needed there.

Sorry, not going to work in TYPO3. Think of TCEmain hooks: you never know 
how they are called: from alt_doc or from a custom script as a part of much 
larger database activity. You may want to start transaction there if you 
change users and groups to keep them consistent. However the calling code 
may want to start the transaction as well because it may update several 
other record types and relation between them. How would you handle this? It 
could be two totally different extensions, written by different people, 
completely unrelated. You way in this case is ..? :)

-- 
Dmitry Dulepov
TYPO3 core&security team member
E-mail: dmitry.dulepov at typo3.org
Web: http://dmitry-dulepov.com/




More information about the TYPO3-dev mailing list