BUGFIX Ensure that the current DB connection is properly closed when scripts stop executing (applies to mssql_close and sqlsrv_close)

This commit is contained in:
Sean Harvey 2009-07-20 07:23:38 +00:00
parent 333ac5f26a
commit b6a0c4f8a4

View File

@ -88,6 +88,16 @@ class MSSQLDatabase extends Database {
} }
} }
public function __destruct() {
if($this->dbConn) {
if(function_exists('mssql_close')) {
mssql_close($this->dbConn);
} elseif(function_exists('sqlsrv_close')) {
sqlsrv_close($this->dbConn);
}
}
}
/** /**
* Throw a database error * Throw a database error
*/ */