Bugzilla – Attachment 115565 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.46 KB, created by
Fridolin Somers
on 2021-01-21 16:04:19 UTC
(
hide
)
Description:
Bug 27511: Don't use NOW() in saved sql last run update
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-01-21 16:04:19 UTC
Size:
1.46 KB
patch
obsolete
>From 9cc80f6b4496602fcc9a86e48f6d325ed25c43e3 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 > >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 >--- > 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 8c89165e2a..fa5d8bb2f3 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -576,7 +576,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.30.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