Database::closeConnection

7 database.inc public static Database::closeConnection($target = NULL, $key = NULL)
8 Database.php public static Database::closeConnection($target = NULL, $key = NULL)

Closes a connection to the server specified by the given key and target.

Parameters

$target: The database target name. Defaults to NULL meaning that all target connections will be closed.

$key: The database connection key. Defaults to NULL which means the active key.

2 calls to Database::closeConnection()

File

includes/database/database.inc, line 1689
Core systems for the database layer.

Code

public static function closeConnection($target = NULL, $key = NULL) {
  // Gets the active connection by default.
  if (!isset($key)) {
    $key = self::$activeKey;
  }
  // To close the connection, we need to unset the static variable.
  if (isset($target)) {
    unset(self::$connections[$key][$target]);
  }
  else {
    unset(self::$connections[$key]);
  }
}
Login or register to post comments