protected function fetchIndexesDb($table = '') {
        $stm = $this->get(
            new Identifier('information_schema', 'STATISTICS'),
            [
                'TABLE_SCHEMA' => $this->getDbName(),
                'TABLE_NAME' => $this->prefixTable($table, false)
            ],
            [
                'columns' => [
                    'INDEX_NAME',
                    'COLUMN_NAME',
                    'NON_UNIQUE'
                ],
                'order' => ['INDEX_NAME', 'SEQ_IN_INDEX']
            ]
        );
        $indexRows = $stm->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);

        $indexes = [];
        foreach ($indexRows as $indexName => $columns) {
            $index = [
                'type' => null,
                'columns' => array_column($columns, 'COLUMN_NAME'),
                'name' => $indexName
            ];

            if ($indexName === 'PRIMARY') {
                $index['type'] = Db::INDEX_PK;
            } else {
                $index['type'] = $columns[0]['NON_UNIQUE'] ? Db::INDEX_IX : Db::INDEX_UNIQUE;
            }
            $indexes[] = $index;
        }

        return $indexes;
    }
protected function fetchIndexesDb($table = '') {
        $stm = $this->get(
            new Identifier('information_schema', 'STATISTICS'),
            [
                'TABLE_SCHEMA' => $this->getDbName(),
                'TABLE_NAME' => $this->prefixTable($table, false)
            ],
            [
                'columns' => [
                    'INDEX_NAME',
                    'COLUMN_NAME',
                    'NON_UNIQUE'
                ],
                'order' => ['INDEX_NAME', 'SEQ_IN_INDEX']
            ]
        );
        $indexRows = $stm->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);

        $indexes = [];
        foreach ($indexRows as $indexName => $columns) {
            $index = [
                'type' => null,
                'columns' => array_column($columns, 'COLUMN_NAME'),
                'name' => $indexName
            ];

            if ($indexName === 'PRIMARY') {
                $index['type'] = Db::INDEX_PK;
            } else {
                $index['type'] = $columns[0]['NON_UNIQUE'] ? Db::INDEX_IX : Db::INDEX_UNIQUE;
            }
            $indexes[] = $index;
        }

        return $indexes;
    }
protected function fetchIndexesDb ( $ table = '' ) { $ stm = $ this -> get ( new Identifier ( 'information_schema' , 'STATISTICS' ) , [ 'TABLE_SCHEMA' => $ this -> getDbName ( ) , 'TABLE_NAME' => $ this -> prefixTable ( $ table , false ) ] , [ 'columns' => [ 'INDEX_NAME' , 'COLUMN_NAME' , 'NON_UNIQUE' ] , 'order' => [ 'INDEX_NAME' , 'SEQ_IN_INDEX' ] ] ) ; $ indexRows = $ stm -> fetchAll ( PDO :: FETCH_ASSOC | PDO :: FETCH_GROUP ) ; $ indexes = [ ] ; foreach ( $ indexRows as $ indexName => $ columns ) { $ index = [ 'type' => null , 'columns' => array_column ( $ columns , 'COLUMN_NAME' ) , 'name' => $ indexName ] ; if ( $ indexName === 'PRIMARY' ) { $ index [ 'type' ] = Db :: INDEX_PK ; } else { $ index [ 'type' ] = $ columns [ 0 ] [ 'NON_UNIQUE' ] ? Db :: INDEX_IX : Db :: INDEX_UNIQUE ; } $ indexes [ ] = $ index ; } return $ indexes ; }
Get the indexes from the database.

@param string $table The name of the table to get the indexes for.
@return array|null
Get the indexes from the database .