Bugzilla – Attachment 119050 Details for
Bug 27511
Don't use NOW() in saved sql last run update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27511: Don't use NOW() in saved sql last run update
Bug-27511-Dont-use-NOW-in-saved-sql-last-run-updat.patch (text/plain), 1.61 KB, created by
PTFS Europe Sandboxes
on 2021-03-31 13:58:22 UTC
(
hide
)
Description:
Bug 27511: Don't use NOW() in saved sql last run update
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2021-03-31 13:58:22 UTC
Size:
1.61 KB
patch
obsolete
>From e2ebdeb02f7437cc3f4a23d3d2441ea330ee830a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 21 Jan 2021 17:01:09 +0100 >Subject: [PATCH] Bug 27511: Don't use NOW() in saved sql last run update >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >When running a report, column last run is updated with current date-time. >We should avoid using NOW(), better calculated date-time in perl. > >With NOW(), when importing a backup dump, you get current date-time in all rows. > >Also, sometimes we see errors in plack logs : >DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction [for Statement "UPDATE saved_sql SET last_run = NOW() WHERE id = ?"] at /home >/koha/src/C4/Reports/Guided.pm line 576. > >Replacing NOW() should avoid this. > >Test plan: >1) Run a sql report >2) Check last run date and time is OK > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > C4/Reports/Guided.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index a76d86ba44..483c34814c 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -588,7 +588,10 @@ sub execute_query { > > my $dbh = C4::Context->dbh; > >- $dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id; >+ if ($report_id) { >+ my $now = output_pref( { dt => dt_from_string(), dateformat => 'iso' } ); >+ $dbh->do( 'UPDATE saved_sql SET last_run = ? WHERE id = ?', undef, $now, $report_id ); >+ } > > my $sth = $dbh->prepare($sql); > eval { >-- >2.11.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 27511
:
115565
| 119050