Use getTables instead of 'SHOW TABLES FROM'
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
f42bd22ddd
commit
e2ce403a79
@ -154,52 +154,50 @@ class Relation
|
||||
}
|
||||
|
||||
$config = Config::getInstance();
|
||||
$tabQuery = 'SHOW TABLES FROM '
|
||||
. Util::backquote($config->selectedServer['pmadb']);
|
||||
$tableRes = $this->dbi->tryQueryAsControlUser($tabQuery);
|
||||
if ($tableRes === false) {
|
||||
$tables = $this->dbi->getTables($config->selectedServer['pmadb'], Connection::TYPE_CONTROL);
|
||||
if ($tables === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
while ($currTable = $tableRes->fetchRow()) {
|
||||
if ($currTable[0] == $config->selectedServer['bookmarktable']) {
|
||||
$relationParams['bookmark'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['relation']) {
|
||||
$relationParams['relation'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['table_info']) {
|
||||
$relationParams['table_info'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['table_coords']) {
|
||||
$relationParams['table_coords'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['column_info']) {
|
||||
$relationParams['column_info'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['pdf_pages']) {
|
||||
$relationParams['pdf_pages'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['history']) {
|
||||
$relationParams['history'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['recent']) {
|
||||
$relationParams['recent'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['favorite']) {
|
||||
$relationParams['favorite'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['table_uiprefs']) {
|
||||
$relationParams['table_uiprefs'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['tracking']) {
|
||||
$relationParams['tracking'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['userconfig']) {
|
||||
$relationParams['userconfig'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['users']) {
|
||||
$relationParams['users'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['usergroups']) {
|
||||
$relationParams['usergroups'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['navigationhiding']) {
|
||||
$relationParams['navigationhiding'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['savedsearches']) {
|
||||
$relationParams['savedsearches'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['central_columns']) {
|
||||
$relationParams['central_columns'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['designer_settings']) {
|
||||
$relationParams['designer_settings'] = (string) $currTable[0];
|
||||
} elseif ($currTable[0] == $config->selectedServer['export_templates']) {
|
||||
$relationParams['export_templates'] = (string) $currTable[0];
|
||||
foreach ($tables as $table) {
|
||||
if ($table == $config->selectedServer['bookmarktable']) {
|
||||
$relationParams['bookmark'] = $table;
|
||||
} elseif ($table == $config->selectedServer['relation']) {
|
||||
$relationParams['relation'] = $table;
|
||||
} elseif ($table == $config->selectedServer['table_info']) {
|
||||
$relationParams['table_info'] = $table;
|
||||
} elseif ($table == $config->selectedServer['table_coords']) {
|
||||
$relationParams['table_coords'] = $table;
|
||||
} elseif ($table == $config->selectedServer['column_info']) {
|
||||
$relationParams['column_info'] = $table;
|
||||
} elseif ($table == $config->selectedServer['pdf_pages']) {
|
||||
$relationParams['pdf_pages'] = $table;
|
||||
} elseif ($table == $config->selectedServer['history']) {
|
||||
$relationParams['history'] = $table;
|
||||
} elseif ($table == $config->selectedServer['recent']) {
|
||||
$relationParams['recent'] = $table;
|
||||
} elseif ($table == $config->selectedServer['favorite']) {
|
||||
$relationParams['favorite'] = $table;
|
||||
} elseif ($table == $config->selectedServer['table_uiprefs']) {
|
||||
$relationParams['table_uiprefs'] = $table;
|
||||
} elseif ($table == $config->selectedServer['tracking']) {
|
||||
$relationParams['tracking'] = $table;
|
||||
} elseif ($table == $config->selectedServer['userconfig']) {
|
||||
$relationParams['userconfig'] = $table;
|
||||
} elseif ($table == $config->selectedServer['users']) {
|
||||
$relationParams['users'] = $table;
|
||||
} elseif ($table == $config->selectedServer['usergroups']) {
|
||||
$relationParams['usergroups'] = $table;
|
||||
} elseif ($table == $config->selectedServer['navigationhiding']) {
|
||||
$relationParams['navigationhiding'] = $table;
|
||||
} elseif ($table == $config->selectedServer['savedsearches']) {
|
||||
$relationParams['savedsearches'] = $table;
|
||||
} elseif ($table == $config->selectedServer['central_columns']) {
|
||||
$relationParams['central_columns'] = $table;
|
||||
} elseif ($table == $config->selectedServer['designer_settings']) {
|
||||
$relationParams['designer_settings'] = $table;
|
||||
} elseif ($table == $config->selectedServer['export_templates']) {
|
||||
$relationParams['export_templates'] = $table;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `db_pma`',
|
||||
'SHOW TABLES FROM `db_pma`;',
|
||||
[['pma__userconfig']],
|
||||
['Tables_in_db_pma'],
|
||||
);
|
||||
@ -296,7 +296,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `db_pma`',
|
||||
'SHOW TABLES FROM `db_pma`;',
|
||||
[['pma__userconfig']],
|
||||
['Tables_in_db_pma'],
|
||||
);
|
||||
@ -573,7 +573,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `db_pma`',
|
||||
'SHOW TABLES FROM `db_pma`;',
|
||||
[
|
||||
['pma__userconfig'],
|
||||
// This is important as it tricks default existing table detection
|
||||
@ -897,7 +897,7 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->addResult('CREATE DATABASE IF NOT EXISTS `phpmyadmin`', true);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `phpmyadmin`',
|
||||
'SHOW TABLES FROM `phpmyadmin`;',
|
||||
[],
|
||||
);
|
||||
$dummyDbi->addSelectDb('phpmyadmin');
|
||||
@ -1483,7 +1483,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `phpmyadmin`',
|
||||
'SHOW TABLES FROM `phpmyadmin`;',
|
||||
[['pma__userconfig']],
|
||||
['Tables_in_phpmyadmin'],
|
||||
);
|
||||
@ -1570,7 +1570,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `phpmyadmin`',
|
||||
'SHOW TABLES FROM `phpmyadmin`;',
|
||||
[['pma__userconfig']],
|
||||
['Tables_in_phpmyadmin'],
|
||||
);
|
||||
@ -1656,7 +1656,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `PMA-storage`',
|
||||
'SHOW TABLES FROM `PMA-storage`;',
|
||||
[['pma__userconfig_custom', 'pma__usergroups']],
|
||||
['Tables_in_PMA-storage'],
|
||||
);
|
||||
@ -1681,7 +1681,7 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `PMA-storage`',
|
||||
'SHOW TABLES FROM `PMA-storage`;',
|
||||
[['pma__userconfig_custom', 'pma__usergroups']],
|
||||
['Tables_in_PMA-storage'],
|
||||
);
|
||||
@ -1766,7 +1766,7 @@ class RelationTest extends AbstractTestCase
|
||||
['Tables_in_PMA-storage'],
|
||||
);
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `PMA-storage`',
|
||||
'SHOW TABLES FROM `PMA-storage`;',
|
||||
[
|
||||
['pma__tracking'],
|
||||
],
|
||||
@ -1796,7 +1796,7 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `PMA-storage`',
|
||||
'SHOW TABLES FROM `PMA-storage`;',
|
||||
[
|
||||
[
|
||||
'pma__userconfig_custom',
|
||||
@ -1888,7 +1888,7 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `PMA-storage`',
|
||||
'SHOW TABLES FROM `PMA-storage`;',
|
||||
[
|
||||
['pma__favorite_custom'],
|
||||
],
|
||||
|
||||
@ -852,7 +852,7 @@ class DbiDummy implements DbiExtension
|
||||
'result' => [['utf8_general_ci']],
|
||||
],
|
||||
['query' => 'SELECT @@collation_database', 'columns' => ['@@collation_database'], 'result' => [['bar']]],
|
||||
['query' => 'SHOW TABLES FROM `phpmyadmin`', 'result' => []],
|
||||
['query' => 'SHOW TABLES FROM `phpmyadmin`;', 'result' => []],
|
||||
[
|
||||
'query' => 'SELECT tracking_active FROM `pmadb`.`tracking`' .
|
||||
" WHERE db_name = 'pma_test_db'" .
|
||||
|
||||
Loading…
Reference in New Issue
Block a user