summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_driver.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index ef77b594e..a955f45d2 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1390,6 +1390,23 @@ abstract class CI_DB_driver {
{
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Destructor
+ *
+ * Closes the database connection, if needed.
+ *
+ * @return void
+ */
+ public function __destruct()
+ {
+ if ($this->conn_id && ! $this->pconnect)
+ {
+ $this->close();
+ }
+ }
+
}
/* End of file DB_driver.php */