protected function buildInsert($tablename, array $row, $quotevals = true, $options = []) {
        if (val(Db::OPTION_UPSERT, $options)) {
            return $this->buildUpsert($tablename, $row, $quotevals, $options);
        } elseif (val(Db::OPTION_IGNORE, $options)) {
            $sql = 'insert ignore ';
        } elseif (val(Db::OPTION_REPLACE, $options)) {
            $sql = 'replace ';
        } else {
            $sql = 'insert ';
        }
        $sql .= $this->backtick($this->px.$tablename);

        // Add the list of values.
        $sql .=
            "\n".$this->bracketList(array_keys($row), '`').
            "\nvalues".$this->bracketList($row, $quotevals ? "'" : '');

        return $sql;
    }
protected function buildInsert($tablename, array $row, $quotevals = true, $options = []) {
        if (val(Db::OPTION_UPSERT, $options)) {
            return $this->buildUpsert($tablename, $row, $quotevals, $options);
        } elseif (val(Db::OPTION_IGNORE, $options)) {
            $sql = 'insert ignore ';
        } elseif (val(Db::OPTION_REPLACE, $options)) {
            $sql = 'replace ';
        } else {
            $sql = 'insert ';
        }
        $sql .= $this->backtick($this->px.$tablename);

        // Add the list of values.
        $sql .=
            "\n".$this->bracketList(array_keys($row), '`').
            "\nvalues".$this->bracketList($row, $quotevals ? "'" : '');

        return $sql;
    }
protected function buildInsert ( $ tablename , array $ row , $ quotevals = true , $ options = [ ] ) { if ( val ( Db :: OPTION_UPSERT , $ options ) ) { return $ this -> buildUpsert ( $ tablename , $ row , $ quotevals , $ options ) ; } elseif ( val ( Db :: OPTION_IGNORE , $ options ) ) { $ sql = 'insert ignore ' ; } elseif ( val ( Db :: OPTION_REPLACE , $ options ) ) { $ sql = 'replace ' ; } else { $ sql = 'insert ' ; } $ sql .= $ this -> backtick ( $ this -> px . $ tablename ) ; // Add the list of values. $ sql .= "\n" . $ this -> bracketList ( array_keys ( $ row ) , '`' ) . "\nvalues" . $ this -> bracketList ( $ row , $ quotevals ? "'" : '' ) ; return $ sql ; }
Build an insert statement.

@param string $tablename The name of the table to insert to.
@param array $row The row to insert.
@param bool $quotevals Whether or not to quote the values.
@param array $options An array of options for the insert. See {@link Db::insert} for the options.
@return string Returns the the sql string of the insert statement.
Build an insert statement .