From 27871e61dddb9ad254978168952d812208d2e781 Mon Sep 17 00:00:00 2001 From: mondrake Date: Wed, 30 Aug 2023 17:20:16 +0200 Subject: [PATCH] VI --- .../Database/mysqli/TransactionManager.php | 64 +------------------ 1 file changed, 3 insertions(+), 61 deletions(-) diff --git a/src/Driver/Database/mysqli/TransactionManager.php b/src/Driver/Database/mysqli/TransactionManager.php index ba9bb57..b6d9223 100644 --- a/src/Driver/Database/mysqli/TransactionManager.php +++ b/src/Driver/Database/mysqli/TransactionManager.php @@ -36,73 +36,15 @@ protected function releaseClientSavepoint(string $name): bool { /** * {@inheritdoc} */ - protected function processRootCommit(): void { - if (!$this->connection->inTransaction()) { - $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided); - $this->processPostTransactionCallbacks(); - return; - } - parent::processRootCommit(); - } - - /** - * {@inheritdoc} - */ - protected function rollbackClientSavepoint(string $name): bool { - if (!$this->connection->inTransaction()) { - $this->resetStack(); - $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided); - $this->processPostTransactionCallbacks(); - return TRUE; - } - return parent::rollbackClientSavepoint($name); - } - - /** - * {@inheritdoc} - */ - protected function releaseClientSavepoint(string $name): bool { - if (!$this->connection->inTransaction()) { - $this->resetStack(); - $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided); - $this->processPostTransactionCallbacks(); - return TRUE; - } - return parent::releaseClientSavepoint($name); + protected function rollbackClientTransaction(): bool { + return $this->connection->getClientConnection()->rollback(); } /** * {@inheritdoc} */ protected function commitClientTransaction(): bool { - if (!$this->connection->inTransaction()) { - $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided); - $this->processPostTransactionCallbacks(); - return TRUE; - } - $clientCommit = $this->connection->getClientConnection()->commit(); - $this->setConnectionTransactionState($clientCommit ? - ClientConnectionTransactionState::Committed : - ClientConnectionTransactionState::CommitFailed - ); - return $clientCommit; - } - - /** - * {@inheritdoc} - */ - protected function rollbackClientTransaction(): bool { - if (!$this->connection->inTransaction()) { - $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided); - $this->processPostTransactionCallbacks(); - trigger_error('Rollback attempted when there is no active transaction. This can cause data integrity issues.', E_USER_WARNING); - } - $clientRollback = $this->connection->getClientConnection()->rollback(); - $this->setConnectionTransactionState($clientRollback ? - ClientConnectionTransactionState::RolledBack : - ClientConnectionTransactionState::RollbackFailed - ); - return $clientRollback; + return $this->connection->getClientConnection()->commit(); } } \ No newline at end of file