my $start_id; # start processing at this bib ID.
my $end_id; # stop processing when this bib ID is reached.
my $max_duration; # max processing duration in seconds
+my $newest_first; # Process records in descending order of edit_date
my $help; # show help text
GetOptions(
'skip-facets' => \$skip_facets,
'start-id=i' => \$start_id,
'end-id=i' => \$end_id,
+ 'newest-first' => \$newest_first,
'max-duration=i' => \$max_duration,
'help' => \$help
);
--end-id
Stop processing when this record ID is reached
+ --newest-first
+ During the initial bib record query, sort records by edit
+ date in descending order, so that records more recently
+ modified/created are processed before older records.
+
--max-duration
Stop processing after this many total seconds have passed.
$where .= " AND id <= $end_id";
}
+my $order_by = $newest_first ?
+ 'ORDER BY edit_date DESC, id DESC' :
+ 'ORDER BY id ASC';
+
# "Gimme the keys! I'll drive!"
my $q = <<END_OF_Q;
SELECT id
FROM biblio.record_entry
$where
-ORDER BY id ASC
+$order_by
END_OF_Q
# Stuffs needed for looping, tracking how many lists of records we