@param $table

@return array
499095
private function getFields($table)
    {
        $fields = $this->entity->getFieldNames();
        if (empty($this->with) && $this->alias === null) {
            return $fields;
        }

        $table = $this->getTableAlias($table);

        $prefixIfMissing = function ($field) use ($table) {
            if (strpos($field, '.') !== false) {
                return $field;
            }

            return $table . '.' . $field;
        };

        return array_map($prefixIfMissing, $fields);
    }
389622
public function table(Table\Table $table)
    {
        $data = [];
        foreach($table->getRows() as $row) {

            $line = [];
            foreach($table->getColumns() as $name => $column) {
                $line[] = $column->render((array) $row);
            }

            $data[] = $line;
        }

        return $data;
    }
816733
protected function generateColumns($table)
    {
        $columns = [];
        $needPK = true;
        foreach ($table->columns as $column) {
            if ($column->autoIncrement) {
                $columns[$column->name] = $column->type == Schema::TYPE_BIGINT ? 'Schema::TYPE_BIGPK' : 'Schema::TYPE_PK';
                $needPK = false;
                continue;
            }
            list($type, $extra) = $this->getSchemaType($column);
            $quote = "'";
            if (!$column->allowNull) {
                $extra .= ' NOT NULL';
            }

            if ($column->defaultValue !== null) {
                $extra .= ' DEFAULT ';
                if ($column->defaultValue instanceof Expression || is_numeric($column->defaultValue)) {
                    $extra .= $column->defaultValue;
                } else {
                    $extra .= "'{$column->defaultValue}'";
                    $quote = '"';
                }
            }

            if (!empty($extra)) {
                $type = "$type . {$quote}$extra{$quote}";
            }
            $columns[$column->name] = $type;
        }
        if ($needPK && !empty($table->primaryKey)) {
            $pks = implode(']], [[', $table->primaryKey);
            $columns[0] = "PRIMARY KEY ([[{$pks}]])";
        }

        return $columns;
    }
80117
public function getColumns($table)
    {
        $query = $this->getUtilityQuery()->showColumns($table);

        $results = $this->query($query, $this->getBinds());
        
        $columns = [];
        foreach ($results as $column) {
            $key = null;
            if ($column['pk'] == 1) {
                $key = 'PRI';
            }
            
            $columns[] = [
                'Field'     => $column['name'],
                'Type'      => $column['type'],
                'Default'   => $column['dflt_value'],
                'Null'      => $column['notnull'] != 1,
                'Key'       => $key
            ];
        }
        
        return $columns;
    }
252197
public function getTable($table)
    {
        return array_merge(
            $this->cache['tables'][$table],
            [
                'fields'      => $this->cache['fields'][$table] ?? [],
                'constraints' => $this->cache['constraints'][$table] ?? [],
            ]
        );
    }
1159569
public function getTableKeys($table)
    {
        $this->connect();

        $keys = array();
        $query = $this->getQuery(true);

        $fieldCasing = $this->getOption(PDO::ATTR_CASE);

        $this->setOption(PDO::ATTR_CASE, PDO::CASE_UPPER);

        $table = strtoupper($table);
        $query->setQuery('pragma table_info( ' . $table . ')');

        // $query->bind(':tableName', $table);

        $this->setQuery($query);
        $rows = $this->loadObjectList();

        foreach ($rows as $column)
        {
            if ($column->PK == 1)
            {
                $keys[$column->NAME] = $column;
            }
        }

        $this->setOption(PDO::ATTR_CASE, $fieldCasing);

        return $keys;
    }
750403
public function get_fields(string $table = ''): ?array
  {
    if ( !empty($this->class_cfg) ){
      if ( $table ){
        return $this->class_cfg['arch'][$table] ?? null;
      }
      return $this->class_cfg['arch'];
    }
    return null;
  }
713000
public function getColumnTypes($table)
    {
        $columns = $this->getSchemaManager()->listTableColumns($table);

        $columnTypes = [];
        foreach ($columns as $column) {
            $columnTypes[$column->getName()] = $column->getType()->getName();
        }

        if (!isset($this->overwrittenColumnTypes[$table])) {
            return $columnTypes;
        }

        return \array_merge($columnTypes, $this->overwrittenColumnTypes[$table]);
    }
654590
protected function _fetchTableColumns($table)
    {
        $result = array();
        $sql    = $this->quoteName($this->getTableNeedle().$table);

        if ($columns = $this->show('SHOW FULL COLUMNS FROM '.$sql, AnDatabase::FETCH_OBJECT_LIST)) {
            foreach ($columns as $column) {
                //Set the table name in the raw info (MySQL doesn't add this)
                $column->Table = $table;

                //Parse the column raw schema data
                $column = $this->_parseColumnInfo($column, $table);

                $result[$column->name] = $column;
            }
        }

        return $result;
    }
1345216
public function getComparators(TableNode $table) {
    $comparators = [];
    $headers = $table->getRow(0);
    foreach ($headers as $header) {
      $comparators[$header] = function ($expected, $actual) {
        if (substr($expected, 0, 1) === "/") {
          return preg_match($expected, $actual);
        } else {
          return $expected === $actual;
        }
      };
    }
    return $comparators;
  }
60003
public function getAll($table)
    {
        if (!array_key_exists($table, $this->rows)) {
            $this->loadTable($table);
        }

        return $this->rows[$table];
    }
531301
public function getTableDefinition($table)
    {
        foreach ($this->getTableDefinitions() as $definition) {
            if ($definition->getName() === $table) {
                return $definition;
            }
        }

        return null;
    }
330127
public function FetchColumns($Table) {
      $Sql = $this->FetchColumnSql($Table);
      $Data = $this->Query($Sql);
      $Return = array();
      foreach($Data->ResultArray() as $Row) {
         if (isset($Row['COLUMN_NAME']))
            $Return[] = $Row['COLUMN_NAME'];
         else
            $Return[] = current($Row);
      }

      return $Return;
   }
321597
public function get_indexes($table) {
        $indexes = array();
        $sql = 'PRAGMA index_list('.$this->prefix.$table.')';
        if ($this->debug) {
            $this->debug_query($sql);
        }
        $rsindexes = $this->pdb->query($sql);
        foreach($rsindexes as $index) {
            $unique = (boolean)$index['unique'];
            $index = $index['name'];
            $sql = 'PRAGMA index_info("'.$index.'")';
            if ($this->debug) {
                $this->debug_query($sql);
            }
            $rscolumns = $this->pdb->query($sql);
            $columns = array();
            foreach($rscolumns as $row) {
                $columns[] = strtolower($row['name']);
            }
            $index = strtolower($index);
            $indexes[$index]['unique'] = $unique;
            $indexes[$index]['columns'] = $columns;
        }
        return $indexes;
    }
1103705
public static function getTableAssignationFields(Table $table): array
    {
        $fields = [];
        $assignationModels = Configure::read('RolesCapabilities.accessCheck.assignationModels');

        foreach ($table->associations() as $association) {
            // skip non-assignation models
            if (!in_array($association->className(), $assignationModels)) {
                continue;
            }

            $fields[] = $association->getForeignKey();
        }

        return $fields;
    }
327712
protected function getTableOptions($table)
    {
        $attributes = [];

        $attributes = $this->getPhinxTablePrimaryKey($attributes, $table);

        // collation
        $attributes = $this->getPhinxTableEngine($attributes, $table);

        // encoding
        $attributes = $this->getPhinxTableEncoding($attributes, $table);

        // collation
        $attributes = $this->getPhinxTableCollation($attributes, $table);

        // comment
        $attributes = $this->getPhinxTableComment($attributes, $table);

        $result = '[' . implode(', ', $attributes) . ']';

        return $result;
    }
567133
public function generateTableOptions(Table $table)
    {
        $code = [];
        $options = $table->getOptions();
        
        $code = $this->valuetize($options);
        return $code === '[]' ? '' : ', ' . $code;
    }