public static function prepareMultiInsert(string $table, array $rows, array $columns = []): array
    {
        if (! $columns) {
            $columns = static::extractColumnsFromRows($rows);
        }
        $columns = static::escapeSqlWords($columns);

        [$params, $valueParts] = array_values(static::generateMultiParams($rows, $columns));

        $sql = 'INSERT INTO ' . static::escapeSqlWords($table) . ' (';
        $sql .= implode(', ', $columns);
        $sql .= ') VALUES ';
        $sql .= implode(', ', $valueParts);

        return [
            'sql' => $sql,
            'params' => $params,
        ];
    }
public static function prepareMultiInsert(string $table, array $rows, array $columns = []): array
    {
        if (! $columns) {
            $columns = static::extractColumnsFromRows($rows);
        }
        $columns = static::escapeSqlWords($columns);

        [$params, $valueParts] = array_values(static::generateMultiParams($rows, $columns));

        $sql = 'INSERT INTO ' . static::escapeSqlWords($table) . ' (';
        $sql .= implode(', ', $columns);
        $sql .= ') VALUES ';
        $sql .= implode(', ', $valueParts);

        return [
            'sql' => $sql,
            'params' => $params,
        ];
    }
public static function prepareMultiInsert ( string $ table , array $ rows , array $ columns = [ ] ) : array { if ( ! $ columns ) { $ columns = static :: extractColumnsFromRows ( $ rows ) ; } $ columns = static :: escapeSqlWords ( $ columns ) ; [ $ params , $ valueParts ] = array_values ( static :: generateMultiParams ( $ rows , $ columns ) ) ; $ sql = 'INSERT INTO ' . static :: escapeSqlWords ( $ table ) . ' (' ; $ sql .= implode ( ', ' , $ columns ) ; $ sql .= ') VALUES ' ; $ sql .= implode ( ', ' , $ valueParts ) ; return [ 'sql' => $ sql , 'params' => $ params , ] ; }
prepares "INSERT" sql statement by multi array of values
to be used for bulk inserts

@param string $table   table name
@param array  $rows    2-dimensional array of values to insert
@param array  $columns columns for insert if $values are not associative

@return array [sql, params] prepared SQL and params

@throws DBALManagerException when number of columns and values does not match
prepares INSERT sql statement by multi array of values to be used for bulk inserts