Fix #4026
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index e58496d..659664d 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -647,7 +647,10 @@
 			}
 
 			// This will trigger a rollback if transactions are being used
-			$this->_trans_status = FALSE;
+			if ($this->_trans_depth !== 0)
+			{
+				$this->_trans_status = FALSE;
+			}
 
 			// Grab the error now, as we might run some additional queries before displaying the error
 			$error = $this->error();