8
unless(grep /blib/, @INC) {
10
@INC = '../lib' if -d '../lib';
19
if ($BerkeleyDB::db_version < 3.1) {
20
print "1..0 # Skipping test, this needs Berkeley DB 3.1.x or better\n" ;
27
my $Dfile = "dbhash.tmp";
28
my $Dfile2 = "dbhash2.tmp";
29
my $Dfile3 = "dbhash3.tmp";
39
my $lex = new LexFile $Dfile ;
41
ok 1, my $db = tie %hash, 'BerkeleyDB::Hash', -Filename => $Dfile,
45
$hash{'Wall'} = 'Larry' ;
46
$hash{'Wall'} = 'Stone' ;
47
$hash{'Smith'} = 'John' ;
48
$hash{'Wall'} = 'Brick' ;
49
$hash{'Wall'} = 'Brick' ;
50
$hash{'mouse'} = 'mickey' ;
52
ok 2, keys %hash == 6 ;
55
ok 3, my $cursor = $db->db_cursor() ;
59
ok 4, $cursor->c_get($key, $value, DB_SET) == 0 ;
60
ok 5, $key eq "Wall" && $value eq "Larry" ;
63
ok 6, $cursor->c_count($count) == 0 ;
67
ok 8, $cursor->c_get($key, $value, DB_SET) == 0 ;
68
ok 9, $key eq "Smith" && $value eq "John" ;
70
ok 10, $cursor->c_count($count) == 0 ;
83
my $lex = new LexFile $Dfile ;
85
ok 12, my $db = tie %hash, 'BerkeleyDB::Btree', -Filename => $Dfile,
89
$hash{'Wall'} = 'Larry' ;
90
$hash{'Wall'} = 'Stone' ;
91
$hash{'Smith'} = 'John' ;
92
$hash{'Wall'} = 'Brick' ;
93
$hash{'Wall'} = 'Brick' ;
94
$hash{'mouse'} = 'mickey' ;
96
ok 13, keys %hash == 6 ;
99
my ($less, $equal, $greater) ;
100
ok 14, $db->db_key_range($key, $less, $equal, $greater) == 0 ;
104
ok 17, $greater != 0 ;
107
ok 18, $db->db_key_range($key, $less, $equal, $greater) == 0 ;
111
ok 21, $greater != 0 ;
114
ok 22, $db->db_key_range($key, $less, $equal, $greater) == 0 ;
118
ok 25, $greater == 1 ;
128
my $lex = new LexFile $Dfile ;
130
ok 26, my $db1 = new BerkeleyDB::Hash -Filename => $Dfile,
132
-Flags => DB_CREATE ;
134
ok 27, my $db2 = new BerkeleyDB::Btree -Filename => $Dfile,
136
-Flags => DB_CREATE ;
147
ok 28, addData($db1, %data) ;
148
ok 29, addData($db2, %data) ;
154
ok 30, BerkeleyDB::db_rename(-Filename => $Dfile,
156
-Newname => "harry") == 0;
158
ok 31, my $db3 = new BerkeleyDB::Hash -Filename => $Dfile,
159
-Subname => "harry" ;
166
my $lex = new LexFile $Dfile, $Dfile2 ;
168
ok 32, my $db1 = new BerkeleyDB::Hash -Filename => $Dfile,
170
-Flags => DB_CREATE ;
181
ok 33, addData($db1, %data) ;
186
ok 34, BerkeleyDB::db_verify(-Filename => $Dfile,
191
ok 35, BerkeleyDB::db_verify(-Filename => $Dfile,