function DatabaseConnection::destroy
Destroys this Connection object.
PHP does not destruct an object if it is still referenced in other variables. In case of PDO database connection objects, PHP only closes the connection when the PDO object is destructed, so any references to this object may cause the number of maximum allowed connections to be exceeded.
File
-
includes/
database/ database.inc, line 364
Class
- DatabaseConnection
- Base Database API class.
Code
public function destroy() {
// Destroy all references to this connection by setting them to NULL.
// The Statement class attribute only accepts a new value that presents a
// proper callable, so we reset it to PDOStatement.
if (!empty($this->statementClass)) {
$this->connection
->setAttribute(PDO::ATTR_STATEMENT_CLASS, array(
'PDOStatement',
array(),
));
}
$this->schema = NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.