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)
committerJason Stephenson <jason@sigio.com>
Sun, 3 Jun 2018 00:14:55 +0000 (20:14 -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>
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) {