function db_table_exists in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/includes/database.inc \db_table_exists()
Checks if a table exists.
Parameters
string $table: The name of the table in drupal (no prefixing).
Return value
bool TRUE if the given table exists, otherwise FALSE.
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 tableExists() on it. E.g. $injected_database->schema()->tableExists($table);
See also
\Drupal\Core\Database\Schema::tableExists()
Related topics
11 calls to db_table_exists()
- drupal_uninstall_schema in core/
includes/ schema.inc - Removes all tables defined in a module's hook_schema().
- FieldSqlStorageTest::testFieldUpdateFailure in core/
modules/ system/ src/ Tests/ Entity/ FieldSqlStorageTest.php - Test that failure to create fields is handled gracefully.
- KernelTestBaseTest::testEnableModulesInstall in core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php - Tests expected installation behavior of enableModules().
- KernelTestBaseTest::testInstallEntitySchema in core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php - Tests expected behavior of installEntitySchema().
- KernelTestBaseTest::testInstallSchema in core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php - Tests expected behavior of installSchema().
File
- core/
includes/ database.inc, line 638 - Core systems for the database layer.
Code
function db_table_exists($table) {
return Database::getConnection()
->schema()
->tableExists($table);
}