ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/BDB.pm
(Generate patch)

Comparing BDB/BDB.pm (file contents):
Revision 1.38 by root, Mon Jul 7 22:11:04 2008 UTC vs.
Revision 1.40 by root, Tue Jul 8 08:35:12 2008 UTC

109use strict 'vars'; 109use strict 'vars';
110 110
111use base 'Exporter'; 111use base 'Exporter';
112 112
113BEGIN { 113BEGIN {
114 our $VERSION = '1.5'; 114 our $VERSION = '1.6';
115 115
116 our @BDB_REQ = qw( 116 our @BDB_REQ = qw(
117 db_env_open db_env_close db_env_txn_checkpoint db_env_lock_detect 117 db_env_open db_env_close db_env_txn_checkpoint db_env_lock_detect
118 db_env_memp_sync db_env_memp_trickle db_env_dbrename db_env_dbremove 118 db_env_memp_sync db_env_memp_trickle db_env_dbrename db_env_dbremove
119 db_open db_close db_compact db_sync db_upgrade 119 db_open db_close db_compact db_sync db_upgrade
278 $int = $env->set_data_dir (const char *dir) 278 $int = $env->set_data_dir (const char *dir)
279 $int = $env->set_tmp_dir (const char *dir) 279 $int = $env->set_tmp_dir (const char *dir)
280 $int = $env->set_lg_dir (const char *dir) 280 $int = $env->set_lg_dir (const char *dir)
281 $int = $env->set_shm_key (long shm_key) 281 $int = $env->set_shm_key (long shm_key)
282 $int = $env->set_cachesize (U32 gbytes, U32 bytes, int ncache = 0) 282 $int = $env->set_cachesize (U32 gbytes, U32 bytes, int ncache = 0)
283 $int = $env->set_flags (U32 flags, int onoff) 283 $int = $env->set_flags (U32 flags, int onoff = 1)
284 $int = $env->log_set_config (U32 flags, int onoff = 1) [v4.7]
285 $int = $env->set_intermediate_dir_mode (const char *modestring) [v4.7]
284 $env->set_errfile (FILE *errfile = 0) 286 $env->set_errfile (FILE *errfile = 0)
285 $env->set_msgfile (FILE *msgfile = 0) 287 $env->set_msgfile (FILE *msgfile = 0)
286 $int = $env->set_verbose (U32 which, int onoff = 1) 288 $int = $env->set_verbose (U32 which, int onoff = 1)
287 $int = $env->set_encrypt (const char *password, U32 flags = 0) 289 $int = $env->set_encrypt (const char *password, U32 flags = 0)
288 $int = $env->set_timeout (NV timeout_seconds, U32 flags = SET_TXN_TIMEOUT) 290 $int = $env->set_timeout (NV timeout_seconds, U32 flags = SET_TXN_TIMEOUT)
538 BDB::poll_wait, BDB::poll_cb 540 BDB::poll_wait, BDB::poll_cb
539 while BDB::nreqs; 541 while BDB::nreqs;
540 542
541=back 543=back
542 544
545=head3 VERSION CHECKING
546
547BerkeleyDB comes in various versions, many of them have minor
548incompatibilities. This means that traditional "at least version x.x"
549checks are often not sufficient.
550
551Example: set the log_autoremove option in a way compatible with <v.47 and
552v4.7. Note the use of & on the constants to avoid triggering a compiletime
553bug when the symbol isn't available.
554
555 $DB_ENV->set_flags (&BDB::LOG_AUTOREMOVE ) if BDB::VERSION v0, v4.7;
556 $DB_ENV->log_set_config (&BDB::LOG_AUTO_REMOVE) if BDB::VERSION v4.7;
557
558=over 4
559
560=item BDB::VERSION
561
562The C<BDB::VERSION> function, when called without arguments, returns the
563Berkeley DB version as a v-string (usually with 3 components). You should
564use C<lt> and C<ge> operators exclusively to make comparisons.
565
566Example: check for at least version 4.7.
567
568 BDB::VERSION ge v4.7 or die;
569
570=item BDB::VERSION min-version
571
572Returns true if the BDB version is at least the given version (specified
573as a v-string), false otherwise.
574
575Example: check for at least version 4.5.
576
577 BDB::VERSION v4.7 or die;
578
579=item BDB::VERSION min-version, max-version
580
581Returns true of the BDB version is at least version C<min-version> (specify C<undef> or C<v0> for any minimum version)
582and less then C<max-version>.
583
584Example: check wether version is strictly less then v4.7.
585
586 BDB::VERSION v0, v4.7
587 or die "version 4.7 is not yet supported";
588
589=back
590
591=cut
592
593sub VERSION {
594 if (@_ > 0) {
595 return undef if VERSION_v lt $_[0];
596 if (@_ > 1) {
597 return undef if VERSION_v ge $_[1];
598 }
599 }
600
601 VERSION_v
602}
603
543=head3 CONTROLLING THE NUMBER OF THREADS 604=head3 CONTROLLING THE NUMBER OF THREADS
544 605
545=over 4 606=over 4
546 607
547=item BDB::min_parallel $nthreads 608=item BDB::min_parallel $nthreads

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines