Bugzilla – Attachment 102151 Details for
Bug 22001
Add RaiseError and PrintError flags for all tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22001: execute reports in an eval
Bug-22001-execute-reports-in-an-eval.patch (text/plain), 1.69 KB, created by
Jonathan Druart
on 2020-03-31 15:59:13 UTC
(
hide
)
Description:
Bug 22001: execute reports in an eval
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-31 15:59:13 UTC
Size:
1.69 KB
patch
obsolete
>From da1b5d8e4b13c75bb1ce8174478b0d9f8d404dbf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 31 Mar 2020 17:55:28 +0200 >Subject: [PATCH] Bug 22001: execute reports in an eval > >Otherwise the tests will fail. We will certainly log twice the error >when run from the UI, but not a big deal. This definitely needs more >attention in a follow-up bug report. >We want to raise proper exceptions here. >--- > C4/Reports/Guided.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index 0a592b58ed..8c89165e2a 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -445,8 +445,11 @@ sub nb_rows { > $dbh->{RaiseError} = $RaiseError; > $dbh->{PrintError} = $PrintError; > if ($@) { # To catch "Duplicate column name" caused by the derived table, or any other syntax error >- $sth = $dbh->prepare($sql); >- $sth->execute; >+ eval { >+ $sth = $dbh->prepare($sql); >+ $sth->execute; >+ }; >+ warn $@ if $@; > # Loop through the complete results, fetching 1,000 rows at a time. This > # lowers memory requirements but increases execution time. > while (my $rows = $sth->fetchall_arrayref(undef, 1000)) { >@@ -576,7 +579,10 @@ sub execute_query { > $dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id; > > my $sth = $dbh->prepare($sql); >- $sth->execute(@$sql_params, $offset, $limit); >+ eval { >+ $sth->execute(@$sql_params, $offset, $limit); >+ }; >+ warn $@ if $@; > > return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err); > return ( $sth ); >-- >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 22001
:
83230
|
83231
|
83232
|
98910
|
98911
|
98912
|
99589
|
99590
|
99591
|
101989
|
101990
|
101991
|
102070
|
102140
|
102147
|
102149
|
102150
| 102151 |
102152