Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.191.70.28
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : 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__
© 2025 GrazzMean