Bug 29579: Show saved SQL report ID in database query
authorKyle Hall <kyle@bywatersolutions.com>
Thu, 21 Jul 2022 17:12:06 +0000 (13:12 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 1 Aug 2022 17:37:09 +0000 (14:37 -0300)
commitf0ba2a8484759d178c5c037f901e2d63a6c97192
treea161727972c75d02ac5763aa998d7761e0b2469d
parent1c924bbcf4913da1659a7aab6a3ea7cd720584c1
Bug 29579: Show saved SQL report ID in database query

When trying to figure out which saved SQL report caused too much load, it's useful to have the report id show in the mysql process list.

This patch adds the saved SQL ID number as a comment line in front
of the SQL before passing it to the database.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Create a long running query like:
   SELECT * FROM borrowers a, borrowers b, borrowers c, borrowers d
4) Connect to the database using koha-mysql
5) Execute "show processlist;"
6) Note the Info column looks something like:
   SELECT * FROM borrowers a, borrowers b, borrowers c, borrowers d /* saved_sql.id: 1 */

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Report.pm