View | Details | Raw Unified | Return to bug 24883
Collapse All | Expand All

(-)a/C4/Installer.pm (-5 / +5 lines)
Lines 496-507 sub process_yml_table { Link Here
496
    my $placeholders = '(' . join ( ",", map { "?" } @columns ) . ')'; # '(?,..,?)' string
496
    my $placeholders = '(' . join ( ",", map { "?" } @columns ) . ')'; # '(?,..,?)' string
497
    my @values;
497
    my @values;
498
    foreach my $row ( @rows ) {
498
    foreach my $row ( @rows ) {
499
        push @values, map {
499
        push @values, [ map {
500
                        my $col = $_;
500
                        my $col = $_;
501
                        ( @multiline and grep { $_ eq $col } @multiline )
501
                        ( @multiline and grep { $_ eq $col } @multiline )
502
                        ? join "\r\n", @{$row->{$col}}                # join multiline values
502
                        ? join "\r\n", @{$row->{$col}}                # join multiline values
503
                        : $row->{$col};
503
                        : $row->{$col};
504
                     } @columns;
504
                     } @columns ];
505
    }
505
    }
506
    return { query => $query, placeholders => $placeholders, values => \@values };
506
    return { query => $query, placeholders => $placeholders, values => \@values };
507
}
507
}
Lines 535-542 sub load_sql { Link Here
535
                    my $placeholders = $query_info->{placeholders};
535
                    my $placeholders = $query_info->{placeholders};
536
                    my $values       = $query_info->{values};
536
                    my $values       = $query_info->{values};
537
                    # Doing only 1 INSERT query for the whole table
537
                    # Doing only 1 INSERT query for the whole table
538
                    $query .= join ', ', ( $placeholders ) x scalar @values;
538
                    my @all_rows_values = map { @$_ } @$values;
539
                    $dbh->do( $query, undef, @values );
539
                    $query .= join ', ', ( $placeholders ) x scalar @$values;
540
                    $dbh->do( $query, undef, @all_rows_values );
540
                }
541
                }
541
                for my $statement ( @{ $yaml->{'sql_statements'} } ) {               # extra SQL statements
542
                for my $statement ( @{ $yaml->{'sql_statements'} } ) {               # extra SQL statements
542
                    $dbh->do($statement);
543
                    $dbh->do($statement);
543
- 

Return to bug 24883