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

(-)a/C4/Installer.pm (-1 / +22 lines)
Lines 480-485 sub process_yml_table { Link Here
480
    return { query => $query, placeholders => $placeholders, values => \@values };
480
    return { query => $query, placeholders => $placeholders, values => \@values };
481
}
481
}
482
482
483
sub yml2sql {
484
    my ( $class, $filepath ) = @_;
485
    my $dbh = C4::Context->dbh;
486
    my $yaml         = LoadFile( $filepath );
487
    my @queries;
488
    for my $table ( @{ $yaml->{'tables'} } ) {
489
        my $query_info   = process_yml_table($table);
490
        my $query        = $query_info->{query};
491
        my $values       = $query_info->{values};
492
        push @queries, $query . "\n" . join(
493
            ",\n",
494
            map {
495
                '(' . join( ', ', map { $dbh->quote($_) } @$_ ) . ')'
496
            } @$values
497
        );
498
    }
499
    for my $statement ( @{ $yaml->{'sql_statements'} } ) {
500
        push @queries, $statement;
501
    }
502
    return join ";\n", @queries;
503
}
504
483
sub load_sql {
505
sub load_sql {
484
    my $self = shift;
506
    my $self = shift;
485
    my $filename = shift;
507
    my $filename = shift;
486
- 

Return to bug 24883