DatabaseConnection::destroy

public function DatabaseConnection::destroy

public 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 323
Core systems for the database layer.

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.
  $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array()));
  $this->schema = NULL;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/DatabaseConnection::destroy/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部