mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
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:
parent
333ac5f26a
commit
b6a0c4f8a4
@ -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
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user