public function getPrimaryKey(array $pk, array $columns, $indent = 0)
    {
        if (empty($pk)) {
            return '';
        }

        // Composite primary keys
        if (2 <= count($pk)) {
            $compositePk = implode(', ', $pk);
            return $this->textIndent($indent) . "'PRIMARY KEY ($compositePk)'," . self::ENTER;
        }
        // Primary key not an auto-increment
        $flag = false;
        foreach ($columns as $column) {
            if ($column->autoIncrement) {
                $flag = true;
            }
        }
        if (false === $flag) {
            return $this->textIndent($indent) . sprintf("'PRIMARY KEY (%s)'," . self::ENTER, $pk[0]);
        }
        return '';
    }
public function getPrimaryKey(array $pk, array $columns, $indent = 0)
    {
        if (empty($pk)) {
            return '';
        }

        // Composite primary keys
        if (2 <= count($pk)) {
            $compositePk = implode(', ', $pk);
            return $this->textIndent($indent) . "'PRIMARY KEY ($compositePk)'," . self::ENTER;
        }
        // Primary key not an auto-increment
        $flag = false;
        foreach ($columns as $column) {
            if ($column->autoIncrement) {
                $flag = true;
            }
        }
        if (false === $flag) {
            return $this->textIndent($indent) . sprintf("'PRIMARY KEY (%s)'," . self::ENTER, $pk[0]);
        }
        return '';
    }
public function getPrimaryKey ( array $ pk , array $ columns , $ indent = 0 ) { if ( empty ( $ pk ) ) { return '' ; } // Composite primary keys if ( 2 <= count ( $ pk ) ) { $ compositePk = implode ( ', ' , $ pk ) ; return $ this -> textIndent ( $ indent ) . "'PRIMARY KEY ($compositePk)'," . self :: ENTER ; } // Primary key not an auto-increment $ flag = false ; foreach ( $ columns as $ column ) { if ( $ column -> autoIncrement ) { $ flag = true ; } } if ( false === $ flag ) { return $ this -> textIndent ( $ indent ) . sprintf ( "'PRIMARY KEY (%s)'," . self :: ENTER , $ pk [ 0 ] ) ; } return '' ; }
Returns the primary key definition.
@param array $pk
@param array $columns
@param int $indent the number of text indent
@return string the primary key definition
Returns the primary key definition .