public function listIndex()
    {
        $table = $this->db->quotekey($this->name);
        $cmd = array(
            'sqlite2?' =>
                "PRAGMA index_list($table);",
            'mysql' =>
                "SHOW INDEX FROM $table;",
            'mssql|sybase|dblib|sqlsrv' =>
                "select * from sys.indexes ".
                "where object_id = (select object_id from sys.objects where name = '$this->name')",
            'pgsql' =>
                "select i.relname as name, ix.indisunique as unique ".
                "from pg_class t, pg_class i, pg_index ix ".
                "where t.oid = ix.indrelid and i.oid = ix.indexrelid ".
                "and t.relkind = 'r' and t.relname = '$this->name'".
                "group by t.relname, i.relname, ix.indisunique;",
        );
        $result = $this->db->exec($this->findQuery($cmd));
        $indexes = array();
        if (preg_match('/pgsql|sqlite2?/', $this->db->driver())) {
            foreach($result as $row)
                $indexes[$row['name']] = array('unique' => $row['unique']);
        } elseif (preg_match('/mssql|sybase|dblib|sqlsrv/', $this->db->driver())) {
            foreach ($result as $row)
                $indexes[$row['name']] = array('unique' => $row['is_unique']);
        } elseif (preg_match('/mysql/', $this->db->driver())) {
            foreach($result as $row)
                $indexes[$row['Key_name']] = array('unique' => !(bool)$row['Non_unique']);
        } else
            trigger_error(sprintf(self::TEXT_ENGINE_NOT_SUPPORTED, $this->db->driver()),E_USER_ERROR);
        return $indexes;
    }
public function listIndex()
    {
        $table = $this->db->quotekey($this->name);
        $cmd = array(
            'sqlite2?' =>
                "PRAGMA index_list($table);",
            'mysql' =>
                "SHOW INDEX FROM $table;",
            'mssql|sybase|dblib|sqlsrv' =>
                "select * from sys.indexes ".
                "where object_id = (select object_id from sys.objects where name = '$this->name')",
            'pgsql' =>
                "select i.relname as name, ix.indisunique as unique ".
                "from pg_class t, pg_class i, pg_index ix ".
                "where t.oid = ix.indrelid and i.oid = ix.indexrelid ".
                "and t.relkind = 'r' and t.relname = '$this->name'".
                "group by t.relname, i.relname, ix.indisunique;",
        );
        $result = $this->db->exec($this->findQuery($cmd));
        $indexes = array();
        if (preg_match('/pgsql|sqlite2?/', $this->db->driver())) {
            foreach($result as $row)
                $indexes[$row['name']] = array('unique' => $row['unique']);
        } elseif (preg_match('/mssql|sybase|dblib|sqlsrv/', $this->db->driver())) {
            foreach ($result as $row)
                $indexes[$row['name']] = array('unique' => $row['is_unique']);
        } elseif (preg_match('/mysql/', $this->db->driver())) {
            foreach($result as $row)
                $indexes[$row['Key_name']] = array('unique' => !(bool)$row['Non_unique']);
        } else
            trigger_error(sprintf(self::TEXT_ENGINE_NOT_SUPPORTED, $this->db->driver()),E_USER_ERROR);
        return $indexes;
    }
public function listIndex ( ) { $ table = $ this -> db -> quotekey ( $ this -> name ) ; $ cmd = array ( 'sqlite2?' => "PRAGMA index_list($table);" , 'mysql' => "SHOW INDEX FROM $table;" , 'mssql|sybase|dblib|sqlsrv' => "select * from sys.indexes " . "where object_id = (select object_id from sys.objects where name = '$this->name')" , 'pgsql' => "select i.relname as name, ix.indisunique as unique " . "from pg_class t, pg_class i, pg_index ix " . "where t.oid = ix.indrelid and i.oid = ix.indexrelid " . "and t.relkind = 'r' and t.relname = '$this->name'" . "group by t.relname, i.relname, ix.indisunique;" , ) ; $ result = $ this -> db -> exec ( $ this -> findQuery ( $ cmd ) ) ; $ indexes = array ( ) ; if ( preg_match ( '/pgsql|sqlite2?/' , $ this -> db -> driver ( ) ) ) { foreach ( $ result as $ row ) $ indexes [ $ row [ 'name' ] ] = array ( 'unique' => $ row [ 'unique' ] ) ; } elseif ( preg_match ( '/mssql|sybase|dblib|sqlsrv/' , $ this -> db -> driver ( ) ) ) { foreach ( $ result as $ row ) $ indexes [ $ row [ 'name' ] ] = array ( 'unique' => $ row [ 'is_unique' ] ) ; } elseif ( preg_match ( '/mysql/' , $ this -> db -> driver ( ) ) ) { foreach ( $ result as $ row ) $ indexes [ $ row [ 'Key_name' ] ] = array ( 'unique' => ! ( bool ) $ row [ 'Non_unique' ] ) ; } else trigger_error ( sprintf ( self :: TEXT_ENGINE_NOT_SUPPORTED , $ this -> db -> driver ( ) ) , E_USER_ERROR ) ; return $ indexes ; }
returns table indexes as assoc array
@return array
returns table indexes as assoc array