fetch marc for GetMarcBiblio and skip xml parsing
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Oct 2010 18:29:19 +0000 (20:29 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 6 Nov 2011 04:45:57 +0000 (05:45 +0100)
this is *HUGE* performance improvement

         old   new
stmts 1112898 786000
subs   295048 228382

C4/Biblio.pm

index a24079d..7d6d3d9 100644 (file)
@@ -1066,6 +1066,9 @@ sub GetMarcBiblio {
     my $biblionumber = shift;
     my $embeditems   = shift || 0;
     my $dbh          = C4::Context->dbh;
+
+=for slow
+
     my $sth          = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
     $sth->execute($biblionumber);
     my $row     = $sth->fetchrow_hashref;
@@ -1082,6 +1085,16 @@ sub GetMarcBiblio {
        C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
 
         return $record;
+
+=cut
+
+    my $sth = $dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber=? ");
+    $sth->execute($biblionumber);
+    my $row = $sth->fetchrow_hashref;
+    if ( $row->{marc} ) {
+       my $record = MARC::Record->new();
+       $record = MARC::Record::new_from_usmarc( $row->{marc} );
+       return $record;
     } else {
         return undef;
     }