protected function indexDefString($table, array $def) {
        $indexName = $this->escape($this->buildIndexName($table, $def));
        if (empty($def['columns'])) {
            throw new \DomainException("The `$table`.$indexName index has no columns.", 500);
        }
        switch (self::val('type', $def, Db::INDEX_IX)) {
            case Db::INDEX_IX:
                return "index $indexName ".$this->bracketList($def['columns'], '`');
            case Db::INDEX_UNIQUE:
                return "unique $indexName ".$this->bracketList($def['columns'], '`');
            case Db::INDEX_PK:
                return "primary key ".$this->bracketList($def['columns'], '`');
        }
        return null;
    }
protected function indexDefString($table, array $def) {
        $indexName = $this->escape($this->buildIndexName($table, $def));
        if (empty($def['columns'])) {
            throw new \DomainException("The `$table`.$indexName index has no columns.", 500);
        }
        switch (self::val('type', $def, Db::INDEX_IX)) {
            case Db::INDEX_IX:
                return "index $indexName ".$this->bracketList($def['columns'], '`');
            case Db::INDEX_UNIQUE:
                return "unique $indexName ".$this->bracketList($def['columns'], '`');
            case Db::INDEX_PK:
                return "primary key ".$this->bracketList($def['columns'], '`');
        }
        return null;
    }
protected function indexDefString ( $ table , array $ def ) { $ indexName = $ this -> escape ( $ this -> buildIndexName ( $ table , $ def ) ) ; if ( empty ( $ def [ 'columns' ] ) ) { throw new \ DomainException ( "The `$table`.$indexName index has no columns." , 500 ) ; } switch ( self :: val ( 'type' , $ def , Db :: INDEX_IX ) ) { case Db :: INDEX_IX : return "index $indexName " . $ this -> bracketList ( $ def [ 'columns' ] , '`' ) ; case Db :: INDEX_UNIQUE : return "unique $indexName " . $ this -> bracketList ( $ def [ 'columns' ] , '`' ) ; case Db :: INDEX_PK : return "primary key " . $ this -> bracketList ( $ def [ 'columns' ] , '`' ) ; } return null ; }
Return the SDL string that defines an index.

@param string $table The name of the table that the index is on.
@param array $def The index definition. This definition should have the following keys.

columns
: An array of columns in the index.
type
: One of "index", "unique", or "primary".
@return null|string Returns the index string or null if the index is not correct.
Return the SDL string that defines an index .