You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2007/12/14 15:35:24 UTC
[OT] How to get BerkeleyDB working?
Hi,
this is not really a mod_perl question but I know there is wisdom about it on
the list.
So, I want to write a number of key-value pairs to a bdb database as a
transaction. Here is my code:
my ($db, $env)=($I->bdb_db, $I->bdb_env);
my $txn=$env->txn_begin;
$txn->Txn($db);
my $count;
# $db->truncate($count);
# warn '['.localtime()."] deleted $count records from db\n";
$count=0;
foreach my $k (keys %update) {
$db->db_put( $k, $update{$k} );
$count++;
}
$db->db_sync;
warn '['.localtime()."] wrote $count records to db\n";
return !$txn->txn_commit;
The bdb environment is created with these flags:
-Flags => DB_CREATE| DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN,
txn_commit return 0 what as I have learned from examples stand for success.
The program says it has put ~1500 to the db but the file on disk is not
touched.
What is wrong?
Thanks,
Torsten
Re: [OT] How to get BerkeleyDB working?
Posted by Torsten Foertsch <to...@gmx.net>.
On Fri 14 Dec 2007, Torsten Foertsch wrote:
> So, I want to write a number of key-value pairs to a bdb database as a
> transaction.
Sorry for the SPAM. I forgot the -Txn flag to BerkeleyDB::Btree->new.
Torsten