| @@ 556-571 (lines=16) @@ | ||
| 553 | * |
|
| 554 | * @return bool <p>This will return true or false indicating success of transaction</p> |
|
| 555 | */ |
|
| 556 | public function beginTransaction() |
|
| 557 | { |
|
| 558 | if ($this->_in_transaction === true) { |
|
| 559 | $this->_debug->displayError('Error: mysql server already in transaction!', false); |
|
| 560 | ||
| 561 | return false; |
|
| 562 | } |
|
| 563 | ||
| 564 | $this->clearErrors(); // needed for "$this->endTransaction()" |
|
| 565 | $this->_in_transaction = true; |
|
| 566 | $return = \mysqli_autocommit($this->link, false); |
|
| 567 | if ($return === false) { |
|
| 568 | $this->_in_transaction = false; |
|
| 569 | } |
|
| 570 | ||
| 571 | return $return; |
|
| 572 | } |
|
| 573 | ||
| 574 | /** |
|
| @@ 743-761 (lines=19) @@ | ||
| 740 | * |
|
| 741 | * @return bool <p>This will return true or false indicating success of transactions.</p> |
|
| 742 | */ |
|
| 743 | public function endTransaction() |
|
| 744 | { |
|
| 745 | if ($this->_in_transaction === false) { |
|
| 746 | $this->_debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 747 | ||
| 748 | return false; |
|
| 749 | } |
|
| 750 | ||
| 751 | if (!$this->errors()) { |
|
| 752 | $return = \mysqli_commit($this->link); |
|
| 753 | } else { |
|
| 754 | $this->rollback(); |
|
| 755 | $return = false; |
|
| 756 | } |
|
| 757 | ||
| 758 | \mysqli_autocommit($this->link, true); |
|
| 759 | $this->_in_transaction = false; |
|
| 760 | ||
| 761 | return $return; |
|
| 762 | } |
|
| 763 | ||
| 764 | /** |
|