function db_driver

Same name in other branches
  1. 7.x includes/database/database.inc \db_driver()

Retrieves the name of the currently active database driver.

Return value

string The name of the currently active database driver.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call driver() on it. For example, $injected_database->driver($string);

See also

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

\Drupal\Core\Database\Connection::driver()

Related topics

1 call to db_driver()
DatabaseLegacyTest::testDbDriver in core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
Tests deprecation of the db_driver() function.

File

core/includes/database.inc, line 436

Code

function db_driver() {
    @trigger_error('db_driver() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call driver() on it. For example, $injected_database->driver($string). See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
    return Database::getConnection()->driver();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.