You are here

function db_close in Drupal 8

Same name and namespace in other branches
  1. 7 includes/database/database.inc \db_close()

Closes the active database connection.

Parameters

array $options: An array of options to control which connection is closed. Only the target key has any meaning in this case.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Database\Database::closeConnection($target).

See also

https://www.drupal.org/node/2993033

\Drupal\Core\Database\Database::closeConnection()

Related topics

1 call to db_close()
DatabaseLegacyTest::testDbClose in core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
Tests the db_close() function.

File

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

Code

function db_close(array $options = []) {
  @trigger_error('db_close() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Use \\Drupal\\Core\\Database\\Database::closeConnection() instead. See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
  Database::closeConnection(_db_get_target($options));
}