diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-05-23 14:14:10 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-05-23 14:14:10 +0200 |
commit | 2fceb85c49142cd512c10080a3cd9ad067f0414c (patch) | |
tree | 861162f9c4b8137d73045e6b71533946fbcfc108 /system/database/DB_driver.php | |
parent | 249204b67d9d437898198ad355d452f467f70dc3 (diff) | |
parent | f46e726cfb726da2ec2095011ffe8625b6f9c816 (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into errors
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r-- | system/database/DB_driver.php | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index ef77b594e..a0812d4c7 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1152,7 +1152,7 @@ abstract class CI_DB_driver { { if ($this->conn_id) { - $this->_close($this->conn_id); + $this->_close(); $this->conn_id = FALSE; } } @@ -1160,6 +1160,20 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- /** + * Close DB Connection + * + * This method would be overriden by most of the drivers. + * + * @return void + */ + protected function _close() + { + $this->conn_id = FALSE; + } + + // -------------------------------------------------------------------- + + /** * Display an error message * * @param string the error message @@ -1390,7 +1404,24 @@ abstract class CI_DB_driver { { } + // -------------------------------------------------------------------- + + /** + * Destructor + * + * Closes the database connection, if needed. + * + * @return void + */ + public function __destruct() + { + if ( ! $this->pconnect) + { + $this->close(); + } + } + } /* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */ +/* Location: ./system/database/DB_driver.php */
\ No newline at end of file |