Granada\ORM::_build_insert PHP Method

_build_insert() protected method

Build an INSERT query
protected _build_insert ( )
    protected function _build_insert()
    {
        $query[] = "INSERT INTO";
        $query[] = $this->_quote_identifier($this->_table_name);
        $field_list = array_map(array($this, '_quote_identifier'), array_keys($this->_dirty_fields));
        $query[] = "(" . join(", ", $field_list) . ")";
        $query[] = "VALUES";
        $placeholders = $this->_create_placeholders($this->_dirty_fields);
        $query[] = "({$placeholders})";
        if (self::$_db[$this->_connection_name]->getAttribute(PDO::ATTR_DRIVER_NAME) == 'pgsql') {
            $query[] = 'RETURNING ' . $this->_quote_identifier($this->_get_id_column_name());
        }
        return join(" ", $query);
    }
ORM