function db_find_tables in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/includes/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
as of Drupal 8.0.x, will be removed in 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. E.g. $injected_database->schema()->findTables($table_expression);
See also
\Drupal\Core\Database\Schema::findTables()
Related topics
2 calls to db_find_tables()
- ModuleTestBase::assertTableCount in core/
modules/ system/ src/ Tests/ Module/ ModuleTestBase.php - Assert there are tables that begin with the specified base table name.
- simpletest_clean_database in core/
modules/ simpletest/ simpletest.module - Removes prefixed tables from the database from crashed tests.
File
- core/
includes/ database.inc, line 680 - Core systems for the database layer.
Code
function db_find_tables($table_expression) {
return Database::getConnection()
->schema()
->findTables($table_expression);
}