====== transCnt ====== ~~NOTOC~~ == Syntax == int ADOconnection::transCnt ===== Description ===== 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: * The value is always 1 when a transaction has been started, as nested transactions are not permitted. For **//smart//** transaction handling: * The value indicates the nesting level of smart transactions. You should not modify the value of this variable manually, as this will likely cause a transaction scope failure. 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. ===== Usage ===== 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()