| @@ 574-589 (lines=16) @@ | ||
| 571 | * |
|
| 572 | * @return bool <p>This will return true or false indicating success of transaction</p> |
|
| 573 | */ |
|
| 574 | public function beginTransaction(): bool |
|
| 575 | { |
|
| 576 | if ($this->_in_transaction === true) { |
|
| 577 | $this->_debug->displayError('Error: mysql server already in transaction!', false); |
|
| 578 | ||
| 579 | return false; |
|
| 580 | } |
|
| 581 | ||
| 582 | $this->clearErrors(); // needed for "$this->endTransaction()" |
|
| 583 | $this->_in_transaction = true; |
|
| 584 | $return = \mysqli_autocommit($this->link, false); |
|
| 585 | if ($return === false) { |
|
| 586 | $this->_in_transaction = false; |
|
| 587 | } |
|
| 588 | ||
| 589 | return $return; |
|
| 590 | } |
|
| 591 | ||
| 592 | /** |
|
| @@ 770-788 (lines=19) @@ | ||
| 767 | * |
|
| 768 | * @return bool <p>This will return true or false indicating success of transactions.</p> |
|
| 769 | */ |
|
| 770 | public function endTransaction(): bool |
|
| 771 | { |
|
| 772 | if ($this->_in_transaction === false) { |
|
| 773 | $this->_debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 774 | ||
| 775 | return false; |
|
| 776 | } |
|
| 777 | ||
| 778 | if (!$this->errors()) { |
|
| 779 | $return = \mysqli_commit($this->link); |
|
| 780 | } else { |
|
| 781 | $this->rollback(); |
|
| 782 | $return = false; |
|
| 783 | } |
|
| 784 | ||
| 785 | \mysqli_autocommit($this->link, true); |
|
| 786 | $this->_in_transaction = false; |
|
| 787 | ||
| 788 | return $return; |
|
| 789 | } |
|
| 790 | ||
| 791 | /** |
|