| @@ 702-727 (lines=26) @@ | ||
| 699 | * |
|
| 700 | * @return bool <p>bool true on success, false otherwise.</p> |
|
| 701 | */ |
|
| 702 | public function commit(): bool |
|
| 703 | { |
|
| 704 | if ($this->in_transaction === false) { |
|
| 705 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 706 | ||
| 707 | return false; |
|
| 708 | } |
|
| 709 | ||
| 710 | if ($this->mysqli_link) { |
|
| 711 | $return = \mysqli_commit($this->mysqli_link); |
|
| 712 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 713 | } elseif ($this->isDoctrinePDOConnection() === true) { |
|
| 714 | $this->doctrine_connection->commit(); |
|
| 715 | $this->doctrine_connection->setAutoCommit(true); |
|
| 716 | ||
| 717 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 718 | $return = true; |
|
| 719 | } else { |
|
| 720 | $return = false; |
|
| 721 | } |
|
| 722 | } |
|
| 723 | ||
| 724 | $this->in_transaction = false; |
|
| 725 | ||
| 726 | return $return; |
|
| 727 | } |
|
| 728 | ||
| 729 | /** |
|
| 730 | * Open a new connection to the MySQL server. |
|
| @@ 2094-2119 (lines=26) @@ | ||
| 2091 | * |
|
| 2092 | * @return bool <p>bool true on success, false otherwise.</p> |
|
| 2093 | */ |
|
| 2094 | public function rollback(): bool |
|
| 2095 | { |
|
| 2096 | if ($this->in_transaction === false) { |
|
| 2097 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 2098 | ||
| 2099 | return false; |
|
| 2100 | } |
|
| 2101 | ||
| 2102 | if ($this->mysqli_link) { |
|
| 2103 | $return = \mysqli_rollback($this->mysqli_link); |
|
| 2104 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 2105 | } elseif ($this->isDoctrinePDOConnection() === true) { |
|
| 2106 | $this->doctrine_connection->rollBack(); |
|
| 2107 | $this->doctrine_connection->setAutoCommit(true); |
|
| 2108 | ||
| 2109 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 2110 | $return = true; |
|
| 2111 | } else { |
|
| 2112 | $return = false; |
|
| 2113 | } |
|
| 2114 | } |
|
| 2115 | ||
| 2116 | $this->in_transaction = false; |
|
| 2117 | ||
| 2118 | return $return; |
|
| 2119 | } |
|
| 2120 | ||
| 2121 | /** |
|
| 2122 | * Try to secure a variable, so can you use it in sql-queries. |
|