Skip Menu |

This queue is for tickets about the BerkeleyDB CPAN distribution.

Report information
The Basics
Id: 39651
Status: resolved
Priority: 0/
Queue: BerkeleyDB

People
Owner: Nobody in particular
Requestors: NUFFIN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.36



Subject: [PATCH] add support for log_{get,set}_config
This patch adds $env->log_get_config and $env->log_set_config This is needed for DB_LOG_AUTO_REMOVE amongst others I couldn't find any reference on when log_{g,s}et_config were introduced though. Cheers, Yuval
Subject: log_get_set_config.patch
Sun Sep 28 02:56:59 EDT 2008 Yuval Kogman <nothingmuch@woobling.org> * log_{get,set}_config diff -rN -u -Nud old-BerkeleyDB-0.35/BerkeleyDB.xs new-BerkeleyDB-0.35/BerkeleyDB.xs --- old-BerkeleyDB-0.35/BerkeleyDB.xs 2008-09-28 02:57:40.000000000 -0400 +++ new-BerkeleyDB-0.35/BerkeleyDB.xs 2008-09-28 02:57:40.000000000 -0400 @@ -2368,6 +2368,53 @@ #endif } +int +log_set_config(env, flags=0, onoff=0) + BerkeleyDB::Env env + u_int32_t flags + int onoff + PREINIT: + dMY_CXT; + CODE: + { +# ifdef AT_LEAST_DB_4 + RETVAL = env->Status = env->Env->log_set_config(env->Env, flags, onoff) ; +# else +# ifdef AT_LEAST_DB_3_3 + RETVAL = env->Status = log_set_config(env->Env, flags, onoff) ; +# else + RETVAL = env->Status = log_set_config(env->Env, flags, onoff) ; +# endif +# endif + } + OUTPUT: + RETVAL + +int +log_get_config(env, flags, onoff) + BerkeleyDB::Env env + u_int32_t flags + SV *onoff + PREINIT: + dMY_CXT; + CODE: + { + int onoffp; +# ifdef AT_LEAST_DB_4 + RETVAL = env->Status = env->Env->log_get_config(env->Env, flags, &onoffp) ; +# else +# ifdef AT_LEAST_DB_3_3 + RETVAL = env->Status = log_get_config(env->Env, flags, &onoffp) ; +# else + RETVAL = env->Status = log_get_config(env->Env, flags, &onoffp) ; +# endif +# endif + sv_setiv(onoff, onoffp); + } + OUTPUT: + RETVAL + + BerkeleyDB::Txn::Raw _txn_begin(env, pid=NULL, flags=0) u_int32_t flags diff -rN -u -Nud old-BerkeleyDB-0.35/t/env.t new-BerkeleyDB-0.35/t/env.t --- old-BerkeleyDB-0.35/t/env.t 2008-09-28 02:57:39.000000000 -0400 +++ new-BerkeleyDB-0.35/t/env.t 2008-09-28 02:57:40.000000000 -0400 @@ -14,7 +14,7 @@ use Test::More ; -plan tests => 53; +plan tests => 60; my $Dfile = "dbhash.tmp"; @@ -268,6 +268,24 @@ undef $env ; } +{ + my $home = "./fred" ; + ok my $lexD = new LexDir($home) ; + chdir "./fred" ; + ok my $env = new BerkeleyDB::Env -Flags => DB_CREATE|DB_INIT_LOG @StdErrFile; + + ok $env->log_get_config( DB_LOG_AUTO_REMOVE, my $on ) == 0, "get config" ; + ok !$on, "config value" ; + + ok $env->log_set_config( DB_LOG_AUTO_REMOVE, 1 ) == 0; + + ok $env->log_get_config( DB_LOG_AUTO_REMOVE, $on ) == 0; + ok $on; + + chdir ".." ; + undef $env ; +} + # test -Verbose # test -Flags # db_value_set
On Sun Sep 28 03:01:09 2008, NUFFIN wrote: Show quoted text
> This patch adds $env->log_get_config and $env->log_set_config > > This is needed for DB_LOG_AUTO_REMOVE amongst others > > I couldn't find any reference on when log_{g,s}et_config were > introduced though. > > > Cheers, > Yuval
Thanks applied (after some modification) & uploaded to CPAN in version 0.36. The two new methods are only available in 4.7 Paul