--- BDB/BDB.pm 2008/07/07 22:11:04 1.38 +++ BDB/BDB.pm 2008/07/08 08:25:31 1.39 @@ -111,7 +111,7 @@ use base 'Exporter'; BEGIN { - our $VERSION = '1.5'; + our $VERSION = '1.6'; our @BDB_REQ = qw( db_env_open db_env_close db_env_txn_checkpoint db_env_lock_detect @@ -280,7 +280,9 @@ $int = $env->set_lg_dir (const char *dir) $int = $env->set_shm_key (long shm_key) $int = $env->set_cachesize (U32 gbytes, U32 bytes, int ncache = 0) - $int = $env->set_flags (U32 flags, int onoff) + $int = $env->set_flags (U32 flags, int onoff = 1) + $int = $env->log_set_config (U32 flags, int onoff = 1) [v4.7] + $int = $env->set_intermediate_dir_mode (const char *modestring) [v4.7] $env->set_errfile (FILE *errfile = 0) $env->set_msgfile (FILE *msgfile = 0) $int = $env->set_verbose (U32 which, int onoff = 1) @@ -540,6 +542,58 @@ =back +=head3 VERSION CHECKING + +BerkeleyDB comes in various versions, many of them have minor +incompatibilities. This means that traditional "at least version x.x" +checks are often not sufficient. + +=over 4 + +=item BDB::VERSION + +The C function, when called without arguments, returns the +Berkeley DB version as a v-string (usually with 3 components). You should +use C and C operators exclusively to make comparisons. + +Example: check for at least version 4.7. + + BDB::VERSION ge v4.7 or die; + +=item BDB::VERSION min-version + +Returns true if the BDB version is at least the given version (specified +as a v-string), false otherwise. + +Example: check for at least version 4.5. + + BDB::VERSION v4.7 or die; + +=item BDB::VERSION min-version, max-version + +Returns true of the BDB version is at least version C (specify C or C for any minimum version) +and less then C. + +Example: check wether version is strictly less then v4.7. + + BDB::VERSION v0, v4.7 + or die "version 4.7 is not yet supported"; + +=back + +=cut + +sub VERSION { + if (@_ > 0) { + return undef if VERSION_v lt $_[0]; + if (@_ > 1) { + return undef if VERSION_v ge $_[1]; + } + } + + VERSION_v +} + =head3 CONTROLLING THE NUMBER OF THREADS =over 4