private static function generatePrimaryKey(array $pk, array $columns)
    {
        if (empty($pk)) {
            return '';
        }
        // Composite primary keys
        if (2 <= count($pk)) {
            $compositePk = implode(', ', $pk);
            return "    'PRIMARY KEY ($compositePk)',\n";
        }
        // Primary key not an auto-increment
        $flag = false;
        foreach ($columns as $column) {
            if ($column->autoIncrement) {
                $flag = true;
            }
        }
        if (false === $flag) {
            return sprintf("    'PRIMARY KEY (%s)',\n", $pk[0]);
        }
        return '';
    }
private static function generatePrimaryKey(array $pk, array $columns)
    {
        if (empty($pk)) {
            return '';
        }
        // Composite primary keys
        if (2 <= count($pk)) {
            $compositePk = implode(', ', $pk);
            return "    'PRIMARY KEY ($compositePk)',\n";
        }
        // Primary key not an auto-increment
        $flag = false;
        foreach ($columns as $column) {
            if ($column->autoIncrement) {
                $flag = true;
            }
        }
        if (false === $flag) {
            return sprintf("    'PRIMARY KEY (%s)',\n", $pk[0]);
        }
        return '';
    }
private static function generatePrimaryKey ( array $ pk , array $ columns ) { if ( empty ( $ pk ) ) { return '' ; } // Composite primary keys if ( 2 <= count ( $ pk ) ) { $ compositePk = implode ( ', ' , $ pk ) ; return "    'PRIMARY KEY ($compositePk)',\n" ; } // Primary key not an auto-increment $ flag = false ; foreach ( $ columns as $ column ) { if ( $ column -> autoIncrement ) { $ flag = true ; } } if ( false === $ flag ) { return sprintf ( "    'PRIMARY KEY (%s)',\n" , $ pk [ 0 ] ) ; } return '' ; }
Returns the primary key definition.
@param array $pk
@param array $columns
@return string the primary key definition
Returns the primary key definition .