Bugzilla – Attachment 49679 Details for
Bug 16168
Eliminate unneeded C4::Context->dbh calls in C4/Biblio.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16168: Eliminate unneeded C4::Context->dbh calls in C4/Biblio.pm
Bug-16168-Eliminate-unneeded-C4Context-dbh-calls-i.patch (text/plain), 2.60 KB, created by
Jonathan Druart
on 2016-03-30 10:53:41 UTC
(
hide
)
Description:
Bug 16168: Eliminate unneeded C4::Context->dbh calls in C4/Biblio.pm
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-03-30 10:53:41 UTC
Size:
2.60 KB
patch
obsolete
>From 656dd2e46a98eb7840742c5dceb21a215242305a Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Wed, 30 Mar 2016 12:21:03 +0200 >Subject: [PATCH] Bug 16168: Eliminate unneeded C4::Context->dbh calls in > C4/Biblio.pm > >Right now, ->dbh calls are actually quite expensive (they involve >DB connection health checks, each and every time). Some speed-sensitive >subroutines inside C4/Biblio.pm (GetMarcStructure, GetAuthorisedValueDesc) >have this statement > > my $dbh = C4::Context->dbh; > >on top of the code, but they don't always/don't usually need DB >handle - not at that stage at least. This trivial patch eliminates >unneeded ->dbh calls in those subroutines. With it, average >GetMarcStructure() running time goes down from 14 miliseconds >to 9 miliseconds (on top of Bug 16166), it also makes catalogue >search profiling a bit easier. > >Test plan: > >1) apply patch >2) ensure that catalogue searches are still working >3) run t/*Biblio* tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Biblio.pm | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 188870c..75afaa1 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1114,7 +1114,6 @@ $frameworkcode : the framework code to read > > sub GetMarcStructure { > my ( $forlibrarian, $frameworkcode ) = @_; >- my $dbh = C4::Context->dbh; > $frameworkcode = "" unless $frameworkcode; > > $forlibrarian = $forlibrarian ? 1 : 0; >@@ -1123,6 +1122,7 @@ sub GetMarcStructure { > my $cached = $cache->get_from_cache($cache_key); > return $cached if $cached; > >+ my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( > "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable > FROM marc_tag_structure >@@ -1667,7 +1667,6 @@ descriptions rather than normal ones when they exist. > > sub GetAuthorisedValueDesc { > my ( $tag, $subfield, $value, $framework, $tagslib, $category, $opac ) = @_; >- my $dbh = C4::Context->dbh; > > if ( !$category ) { > >@@ -1687,6 +1686,7 @@ sub GetAuthorisedValueDesc { > $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'}; > } > >+ my $dbh = C4::Context->dbh; > if ( $category ne "" ) { > my $sth = $dbh->prepare( "SELECT lib, lib_opac FROM authorised_values WHERE category = ? AND authorised_value = ?" ); > $sth->execute( $category, $value ); >@@ -2618,6 +2618,7 @@ hash_ref > > sub TransformMarcToKoha { > my ( $dbh, $record, $frameworkcode, $limit_table ) = @_; >+ ## FIXME: $dbh parameter is never used inside this subroutine ??? > > my $result = {}; > if (!defined $record) { >-- >2.7.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 16168
:
49677
|
49679
|
49828