BerkeleyDB-Lite
    
    
  
  
  
view release on metacpan or search on metacpan
## intended for duplicatekeys
sub recordset {
	my $ref = shift ;
	my $self = tied %$ref ;
	my $key = shift ;
	my $value = "" ;
	my @values = () ;
	# database locked
	my $cursor = $self->db_cursor ;
	if ( $cursor->c_get( $key, $value, DB_SET ) ) {
		$cursor = undef ;
		return @values ;
		}
	push @values, $value ;
	while ( ! $cursor->c_get( $key, $value, DB_NEXT_DUP ) ) {
		push @values, $value ;
		}
	$cursor = undef ;
	return @values ;
	}
## experimental to improve durability
sub sync {
	my $ref = shift ;
	my $self = tied %$ref ;
	$self->db_sync ;
	}
    
  
  
  	}
## intended for duplicatekeys
sub delete {
	my $ref = shift ;
	my $self = tied %$ref ;
	my $key = shift ;
	my $value = shift ;
	my $orig = $value ;
	my $cursor = $self->db_cursor( DB_WRITECURSOR ) ;
	my $status = $cursor->c_get( $key, $value, DB_GET_BOTH ) ;
	## Warning: Ensure consistency between numbers with strings.
	## See Storable documentation.
	$cursor->c_del unless $status ;
	$cursor = undef ;
	return $status ;
	}
sub DESTROY {
	my $ref = shift ;
	my $self = tied %$ref ;
	return unless $self ;
	delete $dbreg{ $self->[0] } ;
    
  
  
  
	my %unique = () ;
	my @keys = () ;
	my @values = () ;
	my @each = () ;
	return [] unless $partkey ;
	my $length = length $partkey ;
	# database locked
	my $cursor = $self->db_cursor ;
	my $value = 0 ;
	my $key = $partkey ;
	my $status = $cursor->c_get( $key, $value, DB_SET_RANGE ) ;
	
	while ( $key ) {
		last if $status || substr( $key, 0, $length ) ne $partkey ;
		if ( $isunique ) {
			$unique{ $key }++ ;
			}
		else {
			push @each, [ $key, $value ] ;
			}
		$status = $cursor->c_get( $key, $value, DB_NEXT ) ;
		}
	
	$cursor = undef ;
	@each = map { [ $_, $unique{$_} ] } keys %unique if $isunique ;
	return \@each ;
	}
sub matchingkeys {
	return map { $_->[0] } @{ dosearch( @_ ) } ;
	}
sub matchingvalues {
	return map { $_->[1] } @{ dosearch( @_ ) } ;
    
  
  
  	return map { @$_ } @{ dosearch( @_ ) } ;
	}
## intended for Btree's with incremented keys
sub nextrecord {
	my $ref = shift ;
	my $self = tied %$ref ;
	my $key = 0 ;
	my $value = 0 ;
	my $cursor = $self->db_cursor() ;
	$cursor->c_get( $key, $value, DB_LAST ) ;
	$ref->{ $key +1 } = {} ;
	$cursor = undef ;
	return $key +1 ;
	}
package BerkeleyDB::Lite::Btree::Lexical ;
	
our @ISA = qw( BerkeleyDB::Lite::Btree ) ;
sub scalars {
	my $invocator = shift ;
    
  
  
  BerkeleyDB/Lite version 1.10
============================
BerkeleyDB::Lite streamlines the use of BerkeleyDB.pm.  For example,
a single constructor acquires both the necessary env and db handles; and
methods wrap common cursor operations.
This installation will place all BerkeleyDB files under a single root.  
This root directory is defined as the 'rootdir' member of the @defaults 
structure.  This definition can be overridden in the constructors.
INSTALLATION
To install this module, edit line 25 of Lite.pm to specify an appropriate
root directory.
    
  
  
  
( run in 0.715 second using v1.01-cache-2.11-cpan-a1d94b6210f )