ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/t/01_basic.t
Revision: 1.2
Committed: Fri Jul 18 22:39:10 2008 UTC (18 years, 2 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-1_8, rel-1_71, rel-1_82, rel-1_83, rel-1_81, rel-1_801
Changes since 1.1: +1 -2 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #! perl
2    
3     print "1..10\n";
4    
5     use BDB;
6    
7     BDB::max_parallel 1;
8    
9     my $env = db_env_create;
10    
11     print $env->set_flags (BDB::AUTO_COMMIT | BDB::TXN_NOSYNC, 1) ? "not " : "", "ok 1\n";
12    
13     $env->set_flags (&BDB::LOG_AUTOREMOVE | &BDB::LOG_INMEMORY ) if BDB::VERSION v0, v4.7;
14     $env->log_set_config (&BDB::LOG_AUTO_REMOVE | &BDB::LOG_IN_MEMORY) if BDB::VERSION v4.7;
15    
16     db_env_open
17     $env,
18     undef,
19     BDB::PRIVATE
20     | BDB::INIT_LOCK | BDB::INIT_LOG | BDB::INIT_MPOOL
21     | BDB::INIT_TXN | BDB::RECOVER | BDB::USE_ENVIRON | BDB::CREATE,
22     0600;
23    
24     print $! ? "not " : "", "ok 2 # $!\n";#d#
25    
26     my $db = db_create $env;
27    
28 root 1.2 db_open $db, undef, undef, undef, BDB::BTREE, BDB::AUTO_COMMIT | BDB::CREATE, 0600;
29 root 1.1
30     print $! ? "not " : "", "ok 3 # $!\n";#d#
31    
32     db_put $db, undef, "key", "data", sub {
33     print "ok 5\n";
34     db_del $db, undef, "key";
35     };
36     db_sync $db, sub {
37     print "ok 6\n";
38     };
39     print "ok 4\n";
40     BDB::flush;
41    
42     print "ok 7\n";
43     db_sync $db;
44     print "ok 8\n";
45    
46     undef $db;
47     print "ok 9\n";
48     undef $env;
49     print "ok 10\n";
50    
51