int ADOconnection::transCnt
The value of $db→transCnt
returns the current transaction nesting level. If no transaction has been started, the value is zero.
For granular transaction handling:
For smart transaction handling:
You can check the value of transCnt to see if a transaction has been started. This is useful in, for example, loadable classes where the start point of a transaction might be in a different procedure.
if ($db->transCnt == 0) $db->startTrans(); /* * transCnt is now 1 Do some work */ $db->startTrans(); /* * transCnt is now 2 */ $db->execute('some insert statement...'); /* * Because the transCnt > 1, the completeTrans is ignored */ $db->completeTrans(); /* * transCnt is now 0, complete the transaction */ $db->completeTrans()