Refactor getTables()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-12-19 01:34:46 +00:00
parent 319ae0d2e3
commit c4f4a1ee9e

View File

@ -303,12 +303,19 @@ class DatabaseInterface implements DbalInterface
return [];
}
/** @var array<int, string> $tables */
$tables = $this->fetchResultSimple(
$result = $this->tryQuery(
'SHOW TABLES FROM ' . Util::backquote($database) . ';',
0,
$connectionType,
cacheAffectedRows: false,
);
if ($result === false) {
return [];
}
/** @var list<string> $tables */
$tables = $result->fetchAllColumn();
if ($this->config->settings['NaturalOrder']) {
usort($tables, strnatcasecmp(...));
}