v5:reference:connection:transcnt
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | v5:reference:connection:transcnt [2016/04/14 15:56] (current) – created mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== transCnt ====== | ||
+ | ~~NOTOC~~ | ||
+ | <WRAP right box> | ||
+ | == Syntax == | ||
+ | int ADOconnection:: | ||
+ | </ | ||
+ | ===== Description ===== | ||
+ | The value of '' | ||
+ | For **// | ||
+ | * The value is always 1 when a transaction has been started, as nested transactions are not permitted. | ||
+ | |||
+ | For **// | ||
+ | * 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 ===== | ||
+ | <code php> | ||
+ | |||
+ | if ($db-> | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * transCnt is now 1 Do some work | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * transCnt is now 2 | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | |||
+ | /* | ||
+ | * Because the transCnt > 1, the completeTrans is ignored | ||
+ | */ | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * transCnt is now 0, complete the transaction | ||
+ | */ | ||
+ | $db-> | ||
+ | </ |
v5/reference/connection/transcnt.txt · Last modified: 2016/04/14 15:56 by mnewnham