public function addRows(array $rows): void
    {
        if (empty($rows)) {
            throw new DatabaseException('Can not perform insert with empty rows.');
        }

        // Collect column names and add to statement:
        $cols = array_keys(reset($rows));
        foreach ($cols as $i => $col) {
            $cols[$i] = $this->quoteName($col);
        }
        $pattern = " (%s) VALUES" . PHP_EOL;
        $this->statement .= sprintf($pattern, implode(',', $cols));

        // Add values for each row to insert statement:
        $rowValues = [];
        foreach ($rows as $row) {
            $placeholders = $this->bindRowValues($row);
            array_push($rowValues, sprintf('(%s)', implode(',', $placeholders)));
        }
        $this->statement .= implode(',', $rowValues);
    }
public function addRows(array $rows): void
    {
        if (empty($rows)) {
            throw new DatabaseException('Can not perform insert with empty rows.');
        }

        // Collect column names and add to statement:
        $cols = array_keys(reset($rows));
        foreach ($cols as $i => $col) {
            $cols[$i] = $this->quoteName($col);
        }
        $pattern = " (%s) VALUES" . PHP_EOL;
        $this->statement .= sprintf($pattern, implode(',', $cols));

        // Add values for each row to insert statement:
        $rowValues = [];
        foreach ($rows as $row) {
            $placeholders = $this->bindRowValues($row);
            array_push($rowValues, sprintf('(%s)', implode(',', $placeholders)));
        }
        $this->statement .= implode(',', $rowValues);
    }
public function addRows ( array $ rows ) : void { if ( empty ( $ rows ) ) { throw new DatabaseException ( 'Can not perform insert with empty rows.' ) ; } // Collect column names and add to statement: $ cols = array_keys ( reset ( $ rows ) ) ; foreach ( $ cols as $ i => $ col ) { $ cols [ $ i ] = $ this -> quoteName ( $ col ) ; } $ pattern = " (%s) VALUES" . PHP_EOL ; $ this -> statement .= sprintf ( $ pattern , implode ( ',' , $ cols ) ) ; // Add values for each row to insert statement: $ rowValues = [ ] ; foreach ( $ rows as $ row ) { $ placeholders = $ this -> bindRowValues ( $ row ) ; array_push ( $ rowValues , sprintf ( '(%s)' , implode ( ',' , $ placeholders ) ) ) ; } $ this -> statement .= implode ( ',' , $ rowValues ) ; }
Adds column names and values to insert statement.

@param array $rows
@throws DatabaseException
@return void
Adds column names and values to insert statement .