/usr/share/perl5/DBM/Deep/Iterator/DBI.pm is in libdbm-deep-perl 2.0011-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | package DBM::Deep::Iterator::DBI;
use strict;
use warnings FATAL => 'all';
use base qw( DBM::Deep::Iterator );
sub reset {
my $self = shift;
eval { $self->{sth}->finish; };
delete $self->{sth};
return;
}
sub get_next_key {
my $self = shift;
my ($obj) = @_;
unless ( exists $self->{sth} ) {
# For mysql, this needs to be RAND()
# For sqlite, this needs to be random()
my $storage = $self->{engine}->storage;
$self->{sth} = $storage->{dbh}->prepare(
"SELECT `key` FROM datas WHERE ref_id = ? ORDER BY "
. $storage->rand_function,
);
$self->{sth}->execute( $self->{base_offset} );
}
my ($key) = $self->{sth}->fetchrow_array;
return $key;
}
1;
__END__
|