Bugzilla – Attachment 3565 Details for
Bug 6020
Reworking C4::Biblio for performance improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-6020-Perf-work-for-Biblio.pm.patch (text/plain), 4.48 KB, created by
Chris Cormack
on 2011-03-31 02:54:36 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-03-31 02:54:36 UTC
Size:
4.48 KB
patch
obsolete
>From 7e8fd37ebeb2ea789faf4ed07465ec7ac862ddfd Mon Sep 17 00:00:00 2001 >From: Henri-Damien LAURENT <henridamien.laurent@biblibre.com> >Date: Mon, 12 Apr 2010 02:56:46 +0200 >Subject: [PATCH] Bug 6020 Perf work for Biblio.pm > >--- > C4/Biblio.pm | 79 ++++++++++++++------------------------------------------- > 1 files changed, 20 insertions(+), 59 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index a0e06f6..1c1e121 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -930,72 +930,33 @@ sub GetMarcStructure { > return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; > } > >- # my $sth = $dbh->prepare( >- # "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?"); >- # $sth->execute($frameworkcode); >- # my ($total) = $sth->fetchrow; >- # $frameworkcode = "" unless ( $total > 0 ); >- my $sth = $dbh->prepare( >- "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable >+ my $lib= ($forlibrarian?'liblibrarian':'IFNULL(libopac,liblibrarian)'); >+ >+ my $restags = $dbh->selectall_hashref( >+ qq{SELECT frameworkcode,tagfield,$lib as lib,mandatory,repeatable > FROM marc_tag_structure >- WHERE frameworkcode=? >- ORDER BY tagfield" >+ ORDER BY frameworkcode,tagfield}, >+ ["frameworkcode", "tagfield"], > ); >- $sth->execute($frameworkcode); >- my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable ); >- >- while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) { >- $res->{$tag}->{lib} = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac; >- $res->{$tag}->{tab} = ""; >- $res->{$tag}->{mandatory} = $mandatory; >- $res->{$tag}->{repeatable} = $repeatable; >- } > >- $sth = $dbh->prepare( >- "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue >+ my $ressubfields = $dbh->selectall_hashref( >+ "SELECT frameworkcode,tagfield,tagsubfield,$lib as lib,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue > FROM marc_subfield_structure >- WHERE frameworkcode=? >- ORDER BY tagfield,tagsubfield >- " >+ ORDER BY frameworkcode,tagfield,tagsubfield", >+ ["frameworkcode", "tagfield","tagsubfield"], > ); >+ my $res; >+ foreach my $fwkcode (keys %$restags){ >+ foreach my $tag (keys %{$restags->{$fwkcode}}){ >+ %{$res->{$fwkcode}->{$tag}}=%{$ressubfields->{$fwkcode}->{$tag}} if ($ressubfields->{$fwkcode}->{$tag}); >+ foreach my $key (keys %{$restags->{$fwkcode}->{$tag}}){ >+ $res->{$fwkcode}->{$tag}->{$key}=$restags->{$fwkcode}->{$tag}->{$key}; >+ } >+ } >+ } >+ $marc_structure_cache->{$forlibrarian} = $res; > >- $sth->execute($frameworkcode); >- >- my $subfield; >- my $authorised_value; >- my $authtypecode; >- my $value_builder; >- my $kohafield; >- my $seealso; >- my $hidden; >- my $isurl; >- my $link; >- my $defaultvalue; >- >- while ( >- ( $tag, $subfield, $liblibrarian, $libopac, $tab, $mandatory, $repeatable, $authorised_value, >- $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue >- ) >- = $sth->fetchrow >- ) { >- $res->{$tag}->{$subfield}->{lib} = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac; >- $res->{$tag}->{$subfield}->{tab} = $tab; >- $res->{$tag}->{$subfield}->{mandatory} = $mandatory; >- $res->{$tag}->{$subfield}->{repeatable} = $repeatable; >- $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value; >- $res->{$tag}->{$subfield}->{authtypecode} = $authtypecode; >- $res->{$tag}->{$subfield}->{value_builder} = $value_builder; >- $res->{$tag}->{$subfield}->{kohafield} = $kohafield; >- $res->{$tag}->{$subfield}->{seealso} = $seealso; >- $res->{$tag}->{$subfield}->{hidden} = $hidden; >- $res->{$tag}->{$subfield}->{isurl} = $isurl; >- $res->{$tag}->{$subfield}->{'link'} = $link; >- $res->{$tag}->{$subfield}->{defaultvalue} = $defaultvalue; >- } >- >- $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; >- >- return $res; >+ return $res->{$frameworkcode}; > } > > =head2 GetUsedMarcStructure >-- >1.7.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 6020
: 3565