Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/xampp/perl/vendor/lib/DBM/Deep/Iterator/ |
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__