function db_find_tables

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

Parameters

$table_expression: An SQL expression, for example "simpletest%" (without the quotes). BEWARE: this is not prefixed, the caller should take care of that.

Return value

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

Related topics

3 calls to db_find_tables()
ModuleTestBase::assertTableCount in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php
Assert there are tables that begin with the specified base table name.
simpletest_clean_database in drupal/core/modules/simpletest/simpletest.module
Removed prefixed tables from the database that are left over from crashed tests.
TestBase::tearDown in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Deletes created files, database tables, and reverts all environment changes.

File

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

Code

function db_find_tables($table_expression) {
  return Database::getConnection()
    ->schema()
    ->findTables($table_expression);
}