Changeset 20417 for lang/php/misc/Hermit/src/Hermit/tx/AbstractHermitTx.php
- Timestamp:
- 10/02/08 01:00:33 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/php/misc/Hermit/src/Hermit/tx/AbstractHermitTx.php
r20152 r20417 7 7 private $txRule = array(); 8 8 private $connection; 9 public function hasTransaction(){ 9 private $begin = false; 10 public final function hasTransaction(){ 11 if($this->begin){ 12 return true; 13 } 14 return $this->begin = $this->connection->beginTransaction(); 10 15 } 11 public function begin(){ 16 public final function begin(){ 17 try { 18 if(!$this->begin){ 19 $this->begin = $this->connection->beginTransaction(); 20 } 21 } catch(Exception $e){ 22 // TODO: Nest transaction 23 throw $e; 24 } 12 25 } 13 public function commit(){ 26 public final function commit(){ 27 try { 28 if($this->connection->commit()){ 29 $this->begin = false; 30 } 31 } catch(Exception $e){ 32 throw $e; 33 } 14 34 } 15 public function rollback(){ 35 public final function rollback(){ 36 try { 37 if ($this->hasTransaction()) { 38 return $this->connection->rollback(); 39 } 40 } catch(Exception $e){ 41 throw $e; 42 } 16 43 } 17 public function suspend(){ 44 public final function suspend(){ 45 return $this->connection; 18 46 } 19 public function resume(PDO $connection){ 47 public final function resume(PDO $connection){ 48 $this->connection = $connection; 20 49 } 21 50 public final function complete(Exception $e){
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)