LP 1768715: Simplify Open-ILS/src/support-scripts/pingest.pl with selectcol_arrayref.
authorJason Stephenson <jstephenson@mvlcstaff.org>
Mon, 11 Apr 2016 14:39:02 +0000 (10:39 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 23 Aug 2018 16:27:54 +0000 (12:27 -0400)
By switching to DBI->selectcol_arrayref in pingest.pl, we can avoid
having to check for references in the main loop.  This eliminates an
extra variable and an extra line of code that are no longer needed.

Signed-off-by: Jason Stephenson <jstephenson@mvlcstaff.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/support-scripts/pingest.pl

index 9c92528..8389c53 100755 (executable)
@@ -152,12 +152,11 @@ if ($opt_pipe) {
     }
 } else {
     my $dbh = DBI->connect('DBI:Pg:');
-    @input = @{$dbh->selectall_arrayref($q)};
+    @input = @{$dbh->selectcol_arrayref($q)};
     $dbh->disconnect();
 }
 
-foreach my $r (@input) {
-    my $record = (ref($r)) ? $r->[0] : $r;
+foreach my $record (@input) {
     push(@blist, $record); # separate list of browse-only ingest
     push(@$records, $record);
     if (++$count == $batch_size) {