public static function DbHandler::listTables in DB Maintenance 8
Same name and namespace in other branches
- 7.2 src/Module/Db/DbHandler.php \Drupal\db_maintenance\Module\Db\DbHandler::listTables()
- 2.0.x src/Module/Db/DbHandler.php \Drupal\db_maintenance\Module\Db\DbHandler::listTables()
Gets a list of all the tables in a database.
Parameters
string $db: The name of the database connection to query for tables.
Return value
array Array representing the tables in the specified database.
2 calls to DbHandler::listTables()
- DbHandler::optimizeTables in src/
Module/ Db/ DbHandler.php - Performs the maintenance.
- DbMaintenanceAdminSettings::buildForm in src/
Form/ DbMaintenanceAdminSettings.php - Form constructor.
File
- src/
Module/ Db/ DbHandler.php, line 87 - DbHandler class.
Class
- DbHandler
- DbHandler class.
Namespace
Drupal\db_maintenance\Module\DbCode
public static function listTables($db) {
$table_names = array();
// Set the database to query.
$previous = Database::setActiveConnection($db);
$handler = DbServerHandlerFactory::getDbServerHandler();
$result = $handler
->listTables();
// Return to the previously set database.
Database::setActiveConnection($previous);
foreach ($result as $table_name) {
$table_name = current($table_name);
$table_names[$table_name] = $table_name;
}
return $table_names;
}