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