CI_DB_forge::_process_primary_keys PHP Method

_process_primary_keys() protected method

Process primary keys
protected _process_primary_keys ( string $table ) : string
$table string Table name
return string
    protected function _process_primary_keys($table)
    {
        $sql = '';
        for ($i = 0, $c = count($this->primary_keys); $i < $c; $i++) {
            if (!isset($this->fields[$this->primary_keys[$i]])) {
                unset($this->primary_keys[$i]);
            }
        }
        if (count($this->primary_keys) > 0) {
            $sql .= ",\n\tCONSTRAINT " . $this->db->escape_identifiers('pk_' . $table) . ' PRIMARY KEY(' . implode(', ', $this->db->escape_identifiers($this->primary_keys)) . ')';
        }
        return $sql;
    }