/**
* Validate whether the table exists.
*
* @return void
*/
protected function validateTableAndLoadFields()
{
$sql = 'DESCRIBE ' . PMA\libraries\Util::backquote($this->tableName);
$result = $GLOBALS['dbi']->tryQuery($sql, null, PMA\libraries\DatabaseInterface::QUERY_STORE);
if (!$result || !$GLOBALS['dbi']->numRows($result)) {
$this->showMissingTableError();
}
if ($this->showKeys) {
$indexes = PMA\libraries\Index::getFromTable($this->tableName, $this->db);
$all_columns = array();
foreach ($indexes as $index) {
$all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
}
$this->fields = array_keys($all_columns);
} else {
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$this->fields[] = $row[0];
}
}
}