summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-11 10:15:27 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-11 10:15:27 +0100
commitbf09a6a29efba486f66282e6f9551903a4cc9f49 (patch)
tree83681fa924709646ecd558a0cdfab2cea8719f79
parent7569337eeffac64aa251f4bf9eeda569e391693b (diff)
parent8de7faa9ff7f342d57966bde0b0429ab241c2a6f (diff)
Merge pull request #4369 from galdiolo/patch-12
Optimize transactions check in CI_DB_driver::query()
-rw-r--r--system/database/DB_driver.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index af6b9f399..59662a946 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -641,19 +641,15 @@ abstract class CI_DB_driver {
// if transactions are enabled. If we don't call this here
// the error message will trigger an exit, causing the
// transactions to remain in limbo.
- if ($this->_trans_depth !== 0)
+ while ($this->_trans_depth !== 0)
{
- do
+ $trans_depth = $this->_trans_depth;
+ $this->trans_complete();
+ if ($trans_depth === $this->_trans_depth)
{
- $trans_depth = $this->_trans_depth;
- $this->trans_complete();
- if ($trans_depth === $this->_trans_depth)
- {
- log_message('error', 'Database: Failure during an automated transaction commit/rollback!');
- break;
- }
+ log_message('error', 'Database: Failure during an automated transaction commit/rollback!');
+ break;
}
- while ($this->_trans_depth !== 0);
}
// Display errors