protected function fetchIndexesDb($table = '') {
        $indexes = [];

        $indexInfos = $this->query('pragma index_list('.$this->prefixTable($table).')')->fetchAll(PDO::FETCH_ASSOC);
        foreach ($indexInfos as $row) {
            $indexName = $row['name'];
            if ($row['unique']) {
                $type = Db::INDEX_UNIQUE;
            } else {
                $type = Db::INDEX_IX;
            }

            // Query the columns in the index.
            $columns = $this->query('pragma index_info('.$this->quote($indexName).')')->fetchAll(PDO::FETCH_ASSOC);

            $index = [
                'name' => $indexName,
                'columns' => array_column($columns, 'name'),
                'type' => $type
            ];
            $indexes[] = $index;
        }

        return $indexes;
    }
protected function fetchIndexesDb($table = '') {
        $indexes = [];

        $indexInfos = $this->query('pragma index_list('.$this->prefixTable($table).')')->fetchAll(PDO::FETCH_ASSOC);
        foreach ($indexInfos as $row) {
            $indexName = $row['name'];
            if ($row['unique']) {
                $type = Db::INDEX_UNIQUE;
            } else {
                $type = Db::INDEX_IX;
            }

            // Query the columns in the index.
            $columns = $this->query('pragma index_info('.$this->quote($indexName).')')->fetchAll(PDO::FETCH_ASSOC);

            $index = [
                'name' => $indexName,
                'columns' => array_column($columns, 'name'),
                'type' => $type
            ];
            $indexes[] = $index;
        }

        return $indexes;
    }
protected function fetchIndexesDb ( $ table = '' ) { $ indexes = [ ] ; $ indexInfos = $ this -> query ( 'pragma index_list(' . $ this -> prefixTable ( $ table ) . ')' ) -> fetchAll ( PDO :: FETCH_ASSOC ) ; foreach ( $ indexInfos as $ row ) { $ indexName = $ row [ 'name' ] ; if ( $ row [ 'unique' ] ) { $ type = Db :: INDEX_UNIQUE ; } else { $ type = Db :: INDEX_IX ; } // Query the columns in the index. $ columns = $ this -> query ( 'pragma index_info(' . $ this -> quote ( $ indexName ) . ')' ) -> fetchAll ( PDO :: FETCH_ASSOC ) ; $ index = [ 'name' => $ indexName , 'columns' => array_column ( $ columns , 'name' ) , 'type' => $ type ] ; $ indexes [ ] = $ index ; } return $ indexes ; }
Get the indexes for a table.

@param string $table The name of the table to get the indexes for or an empty string to get all indexes.
@return array|null
Get the indexes for a table .