Compares tables

@param Table $table

@return array
@throws \Exception
540650
public function equals(Table $table) {
        $prefix = $this->getName() . ': ';
        $errors = [];
        if($table->getName() !== $this->getName()) {
            throw new \Exception('Comparing Incomparable Tables');
        }
        if($table->getEngine() !== $this->getEngine()) {
            $errors[] = $prefix . 'Engine Does Not Match:' . "\n" . $table->getEngine() . "\n" . $this->getEngine();
        }
        if($table->getDefaultCharset() !== $this->getDefaultCharset()) {
            $errors[] = $prefix . 'Default Charset Does Not Match:' . "\n" . $table->getDefaultCharset() . "\n" . $this->getDefaultCharset();
        }
        if($table->getCollate() !== $this->getCollate()) {
            $errors[] = $prefix . 'Collate Does Not Match:' . "\n" . $table->getCollate() . "\n" . $this->getCollate();
        }
        $errors = array_merge($errors, $this->equalsLines($table, $prefix));
        $errors = array_merge($errors, $this->equalsKeys($table, $prefix));
        $errors = array_merge($errors, $this->equalsConstraints($table, $prefix));
        return $errors;
    }
686839
public function hasTable($table) {
        //$sql = $this->grammar->compileTableExists();
        $table = $this->connection->getTablePrefix() . $table;
        return count($this->connection->select(array($table))) > 0;
    }
87614
public function optimize($tables = null)
    {
        if ($tables) {
            $db = self::connect();
            if (is_array($tables)) {
                $tables = implode('`,`', $tables);
                $list = $db->query("OPTIMIZE TABLE `{$tables}`");
            } else {
                $list = $db->query("OPTIMIZE TABLE `{$tables}`");
            }
            if ($list) {
                return $tables;
            } else {
                throw new \Exception("data sheet'{$tables}'Repair mistakes please try again!");
            }
        } else {
            throw new \Exception("Please specify the table to be repaired!");
        }
    }
179093
protected function getTableFields(Table $table)
	{
		$fileds = [];

		foreach ($table->getColumns() as $column) {
			$fileds[] = [
	            'name' => $column->getName(),
	            'type' => $column->getType()->getName(),
	            'not_null' => $column->getNotnull(),
	            'length' => $column->getLength(),
	            'unsigned' => $column->getUnsigned(),
	            'autoincrement' => $column->getAutoincrement(),
	            'primary_key' => $this->isPrimaryKey($table, $column),
	            'foreign_key' => $this->isForeignKey($table, $column)
			];
		}

		return $fileds;
	}
442219
public function tableExists( $table )
    {
        $query = "SELECT name FROM sqlite_master WHERE type='table' AND name='$table'";

        $statement = $this->database->query( $query );

        return ( 0 !== count( $statement->fetchAll() ) );
    }
355275
public function iShouldSeeGivenUnits(TableNode $table)
    {
        foreach ($table as $row) {
            $found = array_filter(
                $this->unitsList,
                function (UnitListItem $unitListItem) use ($row) {
                    return $unitListItem->name == $row['name'] && $unitListItem->shortcut == $row['shortcut'];
                }
            );

            if (!$found) {
                throw new \Exception(sprintf('Unit %s is not found', $row['name']));
            }
        }
    }
306988
public function tableExists($table)
    {
        $result = $this->query("SHOW TABLES LIKE " . $this->pdo->quote($table));
        return $result->rowCount() > 0;
    }
31841
public function filter(Table $table)
    {
        $this->sqlWhere = [];
        $this->sqlParams = [];

        $columns = $table->getColumns();
        foreach ($table->getFilters() as $column => $filters) {
            foreach ($filters as $name => $value) {
                $this->buildFilter($columns[$column]['sql_id'], $columns[$column]['type'], $name, $value);
            }
        }

        if (count($this->sqlWhere) == 0)
            return;

        $ands = [];
        foreach ($this->sqlWhere as $filter => $ors)
            $ands[] = '(' . join(') OR (', $ors) . ')';

        $qb = $this->getQueryBuilder();
        $qb->andWhere('(' . join(') AND (', $ands) .')');
        foreach ($this->sqlParams as $name => $value)
            $qb->setParameter($name, $value);
    }
1179351
public function tableExists($table)
    {
        try {
            $result = $this->query("SELECT 1 FROM `{$table}` LIMIT 1");
        } catch (\Exception $e) {
            return false;
        }

        return $result !== false;
    }
244884
public function getTableColumns(string $table): array
    {
        $schemaTable = self::SCHEMA_COLUMN;

        $where[] = "TABLE_NAME = '{$table}'";
        $where[] = "TABLE_SCHEMA = '{$this->db}'";
        $where   = !empty($where) ? ' WHERE ' . implode(' AND ', $where) : null;

        $querySql = "SELECT `COLUMN_NAME` as `name`,`DATA_TYPE` as `type`,`CHARACTER_MAXIMUM_LENGTH` as `length`,`COLUMN_DEFAULT` as `default` ,`COLUMN_KEY` as `key`,`IS_NULLABLE` as `nullable`,`COLUMN_TYPE` as `column_type`,`COLUMN_COMMENT` as `column_comment` FROM {$schemaTable} {$where}";
        $this->dbHandler->prepare($querySql);
        $this->dbHandler->execute([]);
        $columns = $this->dbHandler->fetch();

        return !empty($columns) ? $columns : [];
    }
384743
public function getColumns($table): ?array
	{
		return $this->driverQuery($this->getSql()->columnList($this->prefixTable($table)), FALSE);
	}
996106
public function getIndexes($table): ?array
	{
		return $this->driverQuery($this->getSql()->indexList($this->prefixTable($table)), FALSE);
	}
444045
public function hasTable($table)
    {
        $sql = $this->grammar->compileTableExists();

        $table = $this->connection->getTablePrefix().$table;

        return count($this->connection->select($sql, array($table))) > 0;
    }
1156965
protected function checkTable(string $table)
    {
        if (!in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) {
            throw new InvalidArgumentException("Invalid table name: `{$table}`.");
        }
    }
1080747
private function _getColumns($table)
    {
        if (isset($this->_tables[$table])) {
            return $this->_tables[$table];
        };
        $this->_tables[$table] = false;
        if ($rows = $this->selectArray("PRAGMA table_info({$table})")) {
            $cols = array();
            foreach ($rows as $row) {
                $cols[] = $row['name'];
            };
            if (count($cols) > 0) {
                $this->_tables[$table] = $cols;
            };
        };
        return $this->_tables[$table];
    }
326451
public function getUnsignedFields(Table $table)
    {
        return $table->getFields()->filter(function (Field $field) {
            return $field->isUnsigned();
        });
    }
1281046
public function getAllMultiTables($table)
    {
        $mLTables = [];
        foreach (array_keys(\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds()) as $langId) {
            $langTableName = getLangTableName($table, $langId);
            if ($table != $langTableName && !in_array($langTableName, $mLTables)) {
                $mLTables[] = $langTableName;
            }
        }

        return $mLTables;
    }