From 2d0e98413070bb05f0a6fb496d5b1a643f5763c0 Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Sun, 1 May 2011 12:11:27 +0000
Subject: [PATCH] Slight optimization for authority_control_fields.pl

Instead of creating two CStoreEditors per bib record, reuse the global
CStoreEditor for read operations; this way we only have to create a new
CStoreEditor if a record has fields to authorize.

Signed-off-by: Dan Scott <dan@coffeecode.net>


git-svn-id: svn://svn.open-ils.org/ILS/trunk@20356 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/support-scripts/authority_control_fields.pl | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Open-ILS/src/support-scripts/authority_control_fields.pl b/Open-ILS/src/support-scripts/authority_control_fields.pl
index d65e8a7611..f8864d0e2c 100755
--- a/Open-ILS/src/support-scripts/authority_control_fields.pl
+++ b/Open-ILS/src/support-scripts/authority_control_fields.pl
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# Copyright (C) 2010 Laurentian University
+# Copyright (C) 2010-2011 Laurentian University
 # Author: Dan Scott <dscott@laurentian.ca>
 #
 # This program is free software; you can redistribute it and/or
@@ -54,12 +54,12 @@ Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("ID
 use OpenILS::Utils::CStoreEditor;
 OpenILS::Utils::CStoreEditor::init();
 
-my $editor = OpenILS::Utils::CStoreEditor->new;
+my $e = OpenILS::Utils::CStoreEditor->new;
 my $undeleted;
 if ($options{all}) {
     # get a list of all non-deleted records from Evergreen
     # open-ils.cstore open-ils.cstore.direct.biblio.record_entry.id_list.atomic {"deleted":"f"}
-    $undeleted = $editor->request( 
+    $undeleted = $e->request( 
         'open-ils.cstore.direct.biblio.record_entry.id_list.atomic', 
         [{deleted => 'f'}, {id => { '>' => 0}}]
     );
@@ -340,7 +340,6 @@ my %controllees = (
 foreach my $rec_id (@records) {
     # print "$rec_id\n";
 
-    my $e = OpenILS::Utils::CStoreEditor->new();
     # State variable; was the record changed?
     my $changed;
 
-- 
2.11.0