| @@ 723-748 (lines=26) @@ | ||
| 720 | * |
|
| 721 | * @return bool <p>bool true on success, false otherwise.</p> |
|
| 722 | */ |
|
| 723 | public function commit(): bool |
|
| 724 | { |
|
| 725 | if ($this->in_transaction === false) { |
|
| 726 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 727 | ||
| 728 | return false; |
|
| 729 | } |
|
| 730 | ||
| 731 | if ($this->mysqli_link) { |
|
| 732 | $return = \mysqli_commit($this->mysqli_link); |
|
| 733 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 734 | } elseif ($this->isDoctrinePDOConnection() === true) { |
|
| 735 | $this->doctrine_connection->commit(); |
|
| 736 | $this->doctrine_connection->setAutoCommit(true); |
|
| 737 | ||
| 738 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 739 | $return = true; |
|
| 740 | } else { |
|
| 741 | $return = false; |
|
| 742 | } |
|
| 743 | } |
|
| 744 | ||
| 745 | $this->in_transaction = false; |
|
| 746 | ||
| 747 | return $return; |
|
| 748 | } |
|
| 749 | ||
| 750 | /** |
|
| 751 | * Open a new connection to the MySQL server. |
|
| @@ 2115-2140 (lines=26) @@ | ||
| 2112 | * |
|
| 2113 | * @return bool <p>bool true on success, false otherwise.</p> |
|
| 2114 | */ |
|
| 2115 | public function rollback(): bool |
|
| 2116 | { |
|
| 2117 | if ($this->in_transaction === false) { |
|
| 2118 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 2119 | ||
| 2120 | return false; |
|
| 2121 | } |
|
| 2122 | ||
| 2123 | if ($this->mysqli_link) { |
|
| 2124 | $return = \mysqli_rollback($this->mysqli_link); |
|
| 2125 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 2126 | } elseif ($this->isDoctrinePDOConnection() === true) { |
|
| 2127 | $this->doctrine_connection->rollBack(); |
|
| 2128 | $this->doctrine_connection->setAutoCommit(true); |
|
| 2129 | ||
| 2130 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 2131 | $return = true; |
|
| 2132 | } else { |
|
| 2133 | $return = false; |
|
| 2134 | } |
|
| 2135 | } |
|
| 2136 | ||
| 2137 | $this->in_transaction = false; |
|
| 2138 | ||
| 2139 | return $return; |
|
| 2140 | } |
|
| 2141 | ||
| 2142 | /** |
|
| 2143 | * Try to secure a variable, so can you use it in sql-queries. |
|