How to use nested DB transactions (MySQL 5+, PostgreSQL)

Comparing #5 with #7

Content

Original source code and idea are from: [PHP, PDO & Nested Transactions](http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/). Tested with: MySQL 5.1.30 + Yii 1.1.8. Problem: Say there is service layer in an application, and one service may use others. Now each service deals will complex business logic will needs to wrap that into transactions.

If there are services A and B here's how it might happen:
[...]
That's it, there you go ;)

 
 
Links
 
-----
 
- [Chinese version](http://www.itkuaixun.com/bbs/thread-206-1-1.html "Chinese version")