Bugzilla – Attachment 101012 Details for
Bug 24883
Add `misc/load_yaml.pl` utility script to allow manual loading of yaml data files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24883: Add a new yml2sql sub to C4::Installer
Bug-24883-Add-a-new-yml2sql-sub-to-C4Installer.patch (text/plain), 1.38 KB, created by
Jonathan Druart
on 2020-03-19 12:24:45 UTC
(
hide
)
Description:
Bug 24883: Add a new yml2sql sub to C4::Installer
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-19 12:24:45 UTC
Size:
1.38 KB
patch
obsolete
>From 55fdf72df80937a0393754ee948dac7a30a7cd9d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 19 Mar 2020 12:33:47 +0100 >Subject: [PATCH] Bug 24883: Add a new yml2sql sub to C4::Installer > >It will allow us to generate sql code from the yml files >--- > C4/Installer.pm | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index b9a0ce53b2..8854cf83df 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -480,6 +480,28 @@ sub process_yml_table { > return { query => $query, placeholders => $placeholders, values => \@values }; > } > >+sub yml2sql { >+ my ( $class, $filepath ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $yaml = LoadFile( $filepath ); >+ my @queries; >+ for my $table ( @{ $yaml->{'tables'} } ) { >+ my $query_info = process_yml_table($table); >+ my $query = $query_info->{query}; >+ my $values = $query_info->{values}; >+ push @queries, $query . "\n" . join( >+ ",\n", >+ map { >+ '(' . join( ', ', map { $dbh->quote($_) } @$_ ) . ')' >+ } @$values >+ ); >+ } >+ for my $statement ( @{ $yaml->{'sql_statements'} } ) { >+ push @queries, $statement; >+ } >+ return join ";\n", @queries; >+} >+ > sub load_sql { > my $self = shift; > my $filename = shift; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24883
:
100831
|
101009
|
101010
|
101011
|
101012
|
101013
|
101292
|
101293
|
101294
|
101332
|
101333
|
101901
|
101902
|
101903
|
101904
|
101905
|
101950
|
101951
|
101952
|
101953
|
101954