Bugzilla – Attachment 35003 Details for
Bug 13068
New feature for DB update and sandbox
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13068: Raise an error if a pl script has a sql error
Bug-13068-Raise-an-error-if-a-pl-script-has-a-sql-.patch (text/plain), 1.96 KB, created by
Jonathan Druart
on 2015-01-07 13:20:40 UTC
(
hide
)
Description:
Bug 13068: Raise an error if a pl script has a sql error
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-01-07 13:20:40 UTC
Size:
1.96 KB
patch
obsolete
>From cfcaa3f52a9a77057feea3c3258624b1c2f8cca6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 5 Jan 2015 17:03:23 +0100 >Subject: [PATCH] Bug 13068: Raise an error if a pl script has a sql error > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Tested with some perl and sql dev updates. Checked the list of dev updates >for the TRACK mode. >Slightly amended the patch for printing the error message. Also the message >now may tell you that a dev update failed. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > installer/data/mysql/updatedatabase.pl | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 08cb721..e5d10c7 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9732,12 +9732,16 @@ sub ExecDBRev { > $rv = 1; > } elsif( $file =~ /\.pl$/ ) { > #Run perl script >+ my $dbh = C4::Context->dbh; >+ $dbh->{RaiseError} = 1; > $rv = do $atomicupd->{location}. "/$file"; > if( !$rv ) { >- print "ERROR: $@\n" if $@; >- print "ERROR: $!\n" if $! && !$@; >- $rv = 1 if !$! && !$@; #apparently, the file does not end with 1; >+ my $msg= $@? "ERROR: $@": ($!? "ERROR: $!\n": ''); >+ chomp $msg; >+ print "$msg\n" if $msg; >+ $rv = 1 if !$msg; #apparently, the file does not end with 1; > } >+ $dbh->{RaiseError} = 0; > } elsif( $file =~ /\.sql$/ ) { > #Run sql file via installer > my $installer = C4::Installer->new(); >@@ -9749,7 +9753,7 @@ sub ExecDBRev { > } > > if( $devrun ) { >- print "Dev upgrade $file done\n"; >+ print "Dev upgrade $file ".( $rv? 'done': 'failed' )."\n"; > _atomic_memory( $atomicupd, $file ) if $rv; > } else { > _atomic_memory( $atomicupd ); #Official dbrev may clear atomic pref >-- >2.1.0
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 13068
:
32173
|
32174
|
32175
|
32177
|
32178
|
32179
|
32180
|
32185
|
32294
|
32300
|
32398
|
32399
|
32525
|
32526
|
32658
|
32659
|
32784
|
32785
|
32839
|
32840
|
32841
|
32842
|
32843
|
32919
|
32921
|
33859
|
34070
|
34071
|
34072
|
34949
|
34950
|
34951
|
34960
|
34998
|
35000
|
35001
|
35002
|
35003
|
35366
|
35367
|
35368
|
35370
|
36716
|
36717
|
36718
|
36719
|
36779
|
36780
|
36781
|
36792
|
37061
|
37062
|
37063
|
37064
|
37065
|
37066
|
37075
|
37076
|
37491