diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-05-23 14:14:33 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-05-23 14:14:33 +0200 |
commit | ae9475557c1968826aee0fa5554899c8329412c2 (patch) | |
tree | d457bcad3afa889602023b53a7e128a27e3ccf10 /system/database/DB_driver.php | |
parent | 4b5616d5dc6ce118a472333b59f23e6eaf735144 (diff) | |
parent | f46e726cfb726da2ec2095011ffe8625b6f9c816 (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into email
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 |