You are here

function db_find_tables in Drupal 8

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

Finds all tables that are like the specified base table name.

Parameters

string $table_expression: An SQL expression, for example "simpletest%" (without the quotes).

Return value

array Array, both the keys and the values are the matching tables.

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, get its schema driver, and call findTables() on it. For example, $injected_database->schema()->findTables($table_expression);

See also

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

\Drupal\Core\Database\Schema::findTables()

Related topics

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

File

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

Code

function db_find_tables($table_expression) {
  @trigger_error('db_find_tables() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Use $injected_database->schema()->findTables($table_expression) instead. See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
  return Database::getConnection()
    ->schema()
    ->findTables($table_expression);
}