| @@ 698-723 (lines=26) @@ | ||
| 695 | * |
|
| 696 | * @return bool <p>Boolean true on success, false otherwise.</p> |
|
| 697 | */ |
|
| 698 | public function commit(): bool |
|
| 699 | { |
|
| 700 | if ($this->in_transaction === false) { |
|
| 701 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 702 | ||
| 703 | return false; |
|
| 704 | } |
|
| 705 | ||
| 706 | if ($this->isDoctrinePDOConnection() === true) { |
|
| 707 | $this->doctrine_connection->commit(); |
|
| 708 | $this->doctrine_connection->setAutoCommit(true); |
|
| 709 | ||
| 710 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 711 | $return = true; |
|
| 712 | } else { |
|
| 713 | $return = false; |
|
| 714 | } |
|
| 715 | } else { |
|
| 716 | $return = \mysqli_commit($this->mysqli_link); |
|
| 717 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 718 | } |
|
| 719 | ||
| 720 | $this->in_transaction = false; |
|
| 721 | ||
| 722 | return $return; |
|
| 723 | } |
|
| 724 | ||
| 725 | /** |
|
| 726 | * Open a new connection to the MySQL server. |
|
| @@ 2072-2097 (lines=26) @@ | ||
| 2069 | * |
|
| 2070 | * @return bool <p>Boolean true on success, false otherwise.</p> |
|
| 2071 | */ |
|
| 2072 | public function rollback(): bool |
|
| 2073 | { |
|
| 2074 | if ($this->in_transaction === false) { |
|
| 2075 | $this->debug->displayError('Error: mysql server is not in transaction!', false); |
|
| 2076 | ||
| 2077 | return false; |
|
| 2078 | } |
|
| 2079 | ||
| 2080 | if ($this->isDoctrinePDOConnection() === true) { |
|
| 2081 | $this->doctrine_connection->rollBack(); |
|
| 2082 | $this->doctrine_connection->setAutoCommit(true); |
|
| 2083 | ||
| 2084 | if ($this->doctrine_connection->isAutoCommit() === true) { |
|
| 2085 | $return = true; |
|
| 2086 | } else { |
|
| 2087 | $return = false; |
|
| 2088 | } |
|
| 2089 | } else { |
|
| 2090 | $return = \mysqli_rollback($this->mysqli_link); |
|
| 2091 | \mysqli_autocommit($this->mysqli_link, true); |
|
| 2092 | } |
|
| 2093 | ||
| 2094 | $this->in_transaction = false; |
|
| 2095 | ||
| 2096 | return $return; |
|
| 2097 | } |
|
| 2098 | ||
| 2099 | /** |
|
| 2100 | * Try to secure a variable, so can you use it in sql-queries. |
|