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