| @@ 543-558 (lines=16) @@ | ||
| 540 | * |
|
| 541 | * @return bool <p>This will return true or false indicating success of transaction</p> |
|
| 542 | */ |
|
| 543 | public function beginTransaction() |
|
| 544 | { |
|
| 545 | if ($this->_in_transaction === true) { |
|
| 546 | $this->_debug->displayError('Error: mysql server already in transaction!', false); |
|
| 547 | ||
| 548 | return false; |
|
| 549 | } |
|
| 550 | ||
| 551 | $this->clearErrors(); // needed for "$this->endTransaction()" |
|
| 552 | $this->_in_transaction = true; |
|
| 553 | $return = \mysqli_autocommit($this->link, false); |
|
| 554 | if ($return === false) { |
|
| 555 | $this->_in_transaction = false; |
|
| 556 | } |
|
| 557 | ||
| 558 | return $return; |
|
| 559 | } |
|
| 560 | ||
| 561 | /** |
|
| @@ 729-747 (lines=19) @@ | ||
| 726 | * |
|
| 727 | * @return bool <p>This will return true or false indicating success of transactions.</p> |
|
| 728 | */ |
|
| 729 | public function endTransaction() |
|
| 730 | { |
|
| 731 | if ($this->_in_transaction === false) { |
|
| 732 | $this->_debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 733 | ||
| 734 | return false; |
|
| 735 | } |
|
| 736 | ||
| 737 | if (!$this->errors()) { |
|
| 738 | $return = \mysqli_commit($this->link); |
|
| 739 | } else { |
|
| 740 | $this->rollback(); |
|
| 741 | $return = false; |
|
| 742 | } |
|
| 743 | ||
| 744 | \mysqli_autocommit($this->link, true); |
|
| 745 | $this->_in_transaction = false; |
|
| 746 | ||
| 747 | return $return; |
|
| 748 | } |
|
| 749 | ||
| 750 | /** |
|