summaryrefslogtreecommitdiff
path: root/db/perl/BerkeleyDB
diff options
context:
space:
mode:
Diffstat (limited to 'db/perl/BerkeleyDB')
-rw-r--r--db/perl/BerkeleyDB/BerkeleyDB.pm230
-rw-r--r--db/perl/BerkeleyDB/BerkeleyDB.pod1
-rw-r--r--db/perl/BerkeleyDB/BerkeleyDB.pod.P1
-rw-r--r--db/perl/BerkeleyDB/BerkeleyDB.xs1107
-rw-r--r--db/perl/BerkeleyDB/Changes6
-rw-r--r--db/perl/BerkeleyDB/MANIFEST2
-rw-r--r--db/perl/BerkeleyDB/Makefile.PL10
-rw-r--r--db/perl/BerkeleyDB/README9
-rw-r--r--db/perl/BerkeleyDB/config.in26
-rw-r--r--db/perl/BerkeleyDB/mkconsts837
10 files changed, 1046 insertions, 1183 deletions
diff --git a/db/perl/BerkeleyDB/BerkeleyDB.pm b/db/perl/BerkeleyDB/BerkeleyDB.pm
index 03374e4d6..e1ae757f8 100644
--- a/db/perl/BerkeleyDB/BerkeleyDB.pm
+++ b/db/perl/BerkeleyDB/BerkeleyDB.pm
@@ -16,7 +16,7 @@ use strict;
use Carp;
use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
-$VERSION = '0.16';
+$VERSION = '0.17';
require Exporter;
require DynaLoader;
@@ -27,41 +27,83 @@ use IO ;
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
-@EXPORT = qw(
+# NOTE -- Do not add to @EXPORT directly. It is written by mkconsts
+@EXPORT = qw(
DB_AFTER
+ DB_AGGRESSIVE
+ DB_ALREADY_ABORTED
DB_APPEND
+ DB_APPLY_LOGREG
+ DB_APP_INIT
DB_ARCH_ABS
DB_ARCH_DATA
DB_ARCH_LOG
DB_BEFORE
+ DB_BROADCAST_EID
DB_BTREE
DB_BTREEMAGIC
DB_BTREEOLDVER
DB_BTREEVERSION
+ DB_CACHED_COUNTS
+ DB_CDB_ALLDB
DB_CHECKPOINT
+ DB_CLIENT
+ DB_CL_WRITER
+ DB_COMMIT
DB_CONSUME
DB_CONSUME_WAIT
DB_CREATE
DB_CURLSN
DB_CURRENT
- DB_DBT_MALLOC
- DB_DBT_PARTIAL
- DB_DBT_USERMEM
+ DB_CXX_NO_EXCEPTIONS
DB_DELETED
DB_DELIMITER
+ DB_DIRTY_READ
+ DB_DONOTINDEX
DB_DUP
+ DB_DUPCURSOR
DB_DUPSORT
DB_ENV_APPINIT
+ DB_ENV_CDB
+ DB_ENV_CDB_ALLDB
+ DB_ENV_CREATE
+ DB_ENV_DBLOCAL
+ DB_ENV_LOCKDOWN
+ DB_ENV_LOCKING
+ DB_ENV_LOGGING
+ DB_ENV_NOLOCKING
+ DB_ENV_NOMMAP
+ DB_ENV_NOPANIC
+ DB_ENV_OPEN_CALLED
+ DB_ENV_PANIC_OK
+ DB_ENV_PRIVATE
+ DB_ENV_REGION_INIT
+ DB_ENV_REP_CLIENT
+ DB_ENV_REP_LOGSONLY
+ DB_ENV_REP_MASTER
+ DB_ENV_RPCCLIENT
+ DB_ENV_RPCCLIENT_GIVEN
DB_ENV_STANDALONE
+ DB_ENV_SYSTEM_MEM
DB_ENV_THREAD
+ DB_ENV_TXN
+ DB_ENV_TXN_NOSYNC
+ DB_ENV_USER_ALLOC
+ DB_ENV_YIELDCPU
DB_EXCL
+ DB_EXTENT
+ DB_FAST_STAT
+ DB_FCNTL_LOCKING
DB_FILE_ID_LEN
DB_FIRST
DB_FIXEDLEN
DB_FLUSH
DB_FORCE
+ DB_GETREC
DB_GET_BOTH
+ DB_GET_BOTHC
+ DB_GET_BOTH_RANGE
DB_GET_RECNO
DB_HASH
DB_HASHMAGIC
@@ -73,75 +115,181 @@ use IO ;
DB_INIT_LOG
DB_INIT_MPOOL
DB_INIT_TXN
- DB_JOIN_ITEM
+ DB_INVALID_EID
+ DB_JAVA_CALLBACK
DB_JOINENV
+ DB_JOIN_ITEM
+ DB_JOIN_NOSORT
DB_KEYEMPTY
DB_KEYEXIST
DB_KEYFIRST
DB_KEYLAST
DB_LAST
+ DB_LOCKDOWN
DB_LOCKMAGIC
DB_LOCKVERSION
DB_LOCK_CONFLICT
DB_LOCK_DEADLOCK
DB_LOCK_DEFAULT
+ DB_LOCK_DUMP
+ DB_LOCK_EXPIRE
+ DB_LOCK_FREE_LOCKER
DB_LOCK_GET
+ DB_LOCK_GET_TIMEOUT
+ DB_LOCK_INHERIT
+ DB_LOCK_MAXLOCKS
+ DB_LOCK_MINLOCKS
+ DB_LOCK_MINWRITE
DB_LOCK_NORUN
DB_LOCK_NOTGRANTED
DB_LOCK_NOTHELD
DB_LOCK_NOWAIT
DB_LOCK_OLDEST
+ DB_LOCK_PUT
+ DB_LOCK_PUT_ALL
+ DB_LOCK_PUT_OBJ
+ DB_LOCK_PUT_READ
DB_LOCK_RANDOM
+ DB_LOCK_RECORD
DB_LOCK_RIW_N
DB_LOCK_RW_N
+ DB_LOCK_SET_TIMEOUT
+ DB_LOCK_SWITCH
+ DB_LOCK_TIMEOUT
+ DB_LOCK_UPGRADE
+ DB_LOCK_UPGRADE_WRITE
DB_LOCK_YOUNGEST
+ DB_LOGC_BUF_SIZE
+ DB_LOGFILEID_INVALID
DB_LOGMAGIC
DB_LOGOLDVER
+ DB_LOGVERSION
+ DB_LOG_DISK
+ DB_LOG_LOCKED
+ DB_LOG_SILENT_ERR
DB_MAX_PAGES
DB_MAX_RECORDS
DB_MPOOL_CLEAN
DB_MPOOL_CREATE
DB_MPOOL_DIRTY
DB_MPOOL_DISCARD
+ DB_MPOOL_EXTENT
DB_MPOOL_LAST
DB_MPOOL_NEW
+ DB_MPOOL_NEW_GROUP
DB_MPOOL_PRIVATE
+ DB_MULTIPLE
+ DB_MULTIPLE_KEY
DB_MUTEXDEBUG
DB_MUTEXLOCKS
DB_NEEDSPLIT
DB_NEXT
DB_NEXT_DUP
+ DB_NEXT_NODUP
+ DB_NODUPDATA
+ DB_NOLOCKING
DB_NOMMAP
+ DB_NOORDERCHK
DB_NOOVERWRITE
+ DB_NOPANIC
+ DB_NORECURSE
+ DB_NOSERVER
+ DB_NOSERVER_HOME
+ DB_NOSERVER_ID
DB_NOSYNC
DB_NOTFOUND
+ DB_ODDFILESIZE
+ DB_OK_BTREE
+ DB_OK_HASH
+ DB_OK_QUEUE
+ DB_OK_RECNO
+ DB_OLD_VERSION
+ DB_OPEN_CALLED
+ DB_OPFLAGS_MASK
+ DB_ORDERCHKONLY
DB_PAD
DB_PAGEYIELD
+ DB_PAGE_LOCK
+ DB_PAGE_NOTFOUND
+ DB_PANIC_ENVIRONMENT
DB_POSITION
+ DB_POSITIONI
DB_PREV
+ DB_PREV_NODUP
DB_PRIVATE
+ DB_PR_HEADERS
+ DB_PR_PAGE
+ DB_PR_RECOVERYTEST
+ DB_QAMMAGIC
+ DB_QAMOLDVER
+ DB_QAMVERSION
DB_QUEUE
DB_RDONLY
+ DB_RDWRMASTER
DB_RECNO
DB_RECNUM
DB_RECORDCOUNT
+ DB_RECORD_LOCK
DB_RECOVER
DB_RECOVER_FATAL
+ DB_REGION_ANON
+ DB_REGION_INIT
+ DB_REGION_MAGIC
+ DB_REGION_NAME
DB_REGISTERED
DB_RENUMBER
+ DB_REP_CLIENT
+ DB_REP_DUPMASTER
+ DB_REP_HOLDELECTION
+ DB_REP_LOGSONLY
+ DB_REP_MASTER
+ DB_REP_NEWMASTER
+ DB_REP_NEWSITE
+ DB_REP_OUTDATED
+ DB_REP_PERMANENT
+ DB_REP_UNAVAIL
+ DB_REVSPLITOFF
DB_RMW
+ DB_RPC_SERVERPROG
+ DB_RPC_SERVERVERS
DB_RUNRECOVERY
+ DB_SALVAGE
+ DB_SECONDARY_BAD
DB_SEQUENTIAL
DB_SET
+ DB_SET_LOCK_TIMEOUT
DB_SET_RANGE
DB_SET_RECNO
+ DB_SET_TXN_NOW
+ DB_SET_TXN_TIMEOUT
DB_SNAPSHOT
+ DB_STAT_CLEAR
+ DB_SURPRISE_KID
DB_SWAPBYTES
+ DB_SYSTEM_MEM
DB_TEMPORARY
+ DB_TEST_POSTDESTROY
+ DB_TEST_POSTEXTDELETE
+ DB_TEST_POSTEXTOPEN
+ DB_TEST_POSTEXTUNLINK
+ DB_TEST_POSTLOG
+ DB_TEST_POSTLOGMETA
+ DB_TEST_POSTOPEN
+ DB_TEST_POSTRENAME
+ DB_TEST_POSTSYNC
+ DB_TEST_PREDESTROY
+ DB_TEST_PREEXTDELETE
+ DB_TEST_PREEXTOPEN
+ DB_TEST_PREEXTUNLINK
+ DB_TEST_PREOPEN
+ DB_TEST_PRERENAME
DB_THREAD
+ DB_TIMEOUT
DB_TRUNCATE
DB_TXNMAGIC
DB_TXNVERSION
+ DB_TXN_ABORT
+ DB_TXN_APPLY
DB_TXN_BACKWARD_ROLL
DB_TXN_CKP
DB_TXN_FORWARD_ROLL
@@ -156,37 +304,44 @@ use IO ;
DB_TXN_NOSYNC
DB_TXN_NOWAIT
DB_TXN_OPENFILES
+ DB_TXN_POPENFILES
DB_TXN_REDO
DB_TXN_SYNC
DB_TXN_UNDO
+ DB_UNKNOWN
+ DB_UNRESOLVED_CHILD
+ DB_UPDATE_SECONDARY
+ DB_UPGRADE
DB_USE_ENVIRON
DB_USE_ENVIRON_ROOT
+ DB_VERB_CHKPOINT
+ DB_VERB_DEADLOCK
+ DB_VERB_RECOVERY
+ DB_VERB_WAITSFOR
+ DB_VERIFY
+ DB_VERIFY_BAD
+ DB_VERIFY_FATAL
DB_VERSION_MAJOR
DB_VERSION_MINOR
DB_VERSION_PATCH
+ DB_VERSION_STRING
+ DB_VRFY_FLAGMASK
DB_WRITECURSOR
+ DB_WRITELOCK
+ DB_XA_CREATE
+ DB_XIDDATASIZE
+ DB_YIELDCPU
);
sub AUTOLOAD {
- # This AUTOLOAD is used to 'autoload' constants from the constant()
- # XS function. If a constant is not found then control is passed
- # to the AUTOLOAD in AutoLoader.
-
- my $constname;
+ my($constname);
($constname = $AUTOLOAD) =~ s/.*:://;
- my $val = constant($constname, @_ ? $_[0] : 0);
- if ($! != 0) {
- if ($! =~ /Invalid/) {
- $AutoLoader::AUTOLOAD = $AUTOLOAD;
- goto &AutoLoader::AUTOLOAD;
- }
- else {
- croak "Your vendor has not defined BerkeleyDB macro $constname";
- }
- }
- eval "sub $AUTOLOAD { $val }";
- goto &$AUTOLOAD;
-}
+ my ($error, $val) = constant($constname);
+ Carp::croak $error if $error;
+ no strict 'refs';
+ *{$AUTOLOAD} = sub { $val };
+ goto &{$AUTOLOAD};
+}
bootstrap BerkeleyDB $VERSION;
@@ -656,6 +811,12 @@ sub new
*BerkeleyDB::Queue::TIEARRAY = \&BerkeleyDB::Queue::new ;
+sub UNSHIFT
+{
+ my $self = shift;
+ croak "unshift is unsupported with Queue databases";
+}
+
## package BerkeleyDB::Text ;
##
## use vars qw(@ISA) ;
@@ -938,13 +1099,12 @@ sub SHIFT
sub UNSHIFT
{
my $self = shift;
- croak "unshift is unsupported with Queue databases"
- if $self->type == BerkeleyDB::DB_QUEUE() ;
if (@_)
{
my ($key, $value) = (0, 0) ;
my $cursor = $self->db_cursor() ;
- if ($cursor->c_get($key, $value, BerkeleyDB::DB_FIRST()) == 0)
+ my $status = $cursor->c_get($key, $value, BerkeleyDB::DB_FIRST()) ;
+ if ($status == 0)
{
foreach $value (reverse @_)
{
@@ -952,6 +1112,14 @@ sub UNSHIFT
$cursor->c_put($key, $value, BerkeleyDB::DB_BEFORE()) ;
}
}
+ elsif ($status == BerkeleyDB::DB_NOTFOUND())
+ {
+ $key = 0 ;
+ foreach $value (@_)
+ {
+ $self->db_put($key++, $value) ;
+ }
+ }
}
}
@@ -960,14 +1128,16 @@ sub PUSH
my $self = shift;
if (@_)
{
- my ($key, $value) = (0, 0) ;
+ my ($key, $value) = (-1, 0) ;
my $cursor = $self->db_cursor() ;
- if ($cursor->c_get($key, $value, BerkeleyDB::DB_LAST()) == 0)
+ my $status = $cursor->c_get($key, $value, BerkeleyDB::DB_LAST()) ;
+ if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND())
{
+ $key = -1 if $status != 0 and $self->type != BerkeleyDB::DB_RECNO() ;
foreach $value (@_)
{
++ $key ;
- $self->db_put($key, $value) ;
+ $status = $self->db_put($key, $value) ;
}
}
diff --git a/db/perl/BerkeleyDB/BerkeleyDB.pod b/db/perl/BerkeleyDB/BerkeleyDB.pod
index 0509fd5fe..a6c18c82a 100644
--- a/db/perl/BerkeleyDB/BerkeleyDB.pod
+++ b/db/perl/BerkeleyDB/BerkeleyDB.pod
@@ -68,6 +68,7 @@ BerkeleyDB - Perl extension for Berkeley DB version 2 or 3
$status = $txn->txn_commit()
$status = $txn->txn_abort()
$status = $txn->txn_id()
+ $status = $txn->txn_discard()
$status = $env->set_lg_dir();
$status = $env->set_lg_bsize();
diff --git a/db/perl/BerkeleyDB/BerkeleyDB.pod.P b/db/perl/BerkeleyDB/BerkeleyDB.pod.P
index da1c5e60a..644cdb931 100644
--- a/db/perl/BerkeleyDB/BerkeleyDB.pod.P
+++ b/db/perl/BerkeleyDB/BerkeleyDB.pod.P
@@ -68,6 +68,7 @@ BerkeleyDB - Perl extension for Berkeley DB version 2 or 3
$status = $txn->txn_commit()
$status = $txn->txn_abort()
$status = $txn->txn_id()
+ $status = $txn->txn_discard()
$status = $env->set_lg_dir();
$status = $env->set_lg_bsize();
diff --git a/db/perl/BerkeleyDB/BerkeleyDB.xs b/db/perl/BerkeleyDB/BerkeleyDB.xs
index c2230e053..5a26166bd 100644
--- a/db/perl/BerkeleyDB/BerkeleyDB.xs
+++ b/db/perl/BerkeleyDB/BerkeleyDB.xs
@@ -83,6 +83,10 @@ extern "C" {
# define AT_LEAST_DB_3_3
#endif
+#if DB_VERSION_MAJOR >= 4
+# define AT_LEAST_DB_4
+#endif
+
/* need to define DEFSV & SAVE_DEFSV for older version of Perl */
#ifndef DEFSV
# define DEFSV GvSV(defgv)
@@ -577,7 +581,11 @@ close_everything(void)
tid = * (BerkeleyDB__Txn__Raw *) hv_iterkey(he, &len) ;
Trace((" Aborting Transaction [%d] in [%d] Active [%d]\n", tid->txn, tid, tid->active));
if (tid->active) {
+#ifdef AT_LEAST_DB_4
+ tid->txn->abort(tid->txn) ;
+#else
txn_abort(tid->txn);
+#endif
++ closed ;
}
tid->active = FALSE ;
@@ -695,7 +703,7 @@ destroyDB(BerkeleyDB db)
Safefree(db) ;
}
-static void
+static int
softCrash(const char *pat, ...)
{
char buffer1 [500] ;
@@ -717,6 +725,7 @@ softCrash(const char *pat, ...)
/* NOTREACHED */
va_end(args);
+ return 1 ;
}
@@ -1248,7 +1257,7 @@ my_db_open(
if ((Status = db_open(file, type, flags, mode, env, info, &dbp)) == 0) {
#endif /* DB_VERSION_MAJOR == 2 */
- Trace(("db_opened\n"));
+ Trace(("db_opened ok\n"));
RETVAL = db ;
#ifdef AT_LEAST_DB_3_3
dbp->set_alloc(dbp, safemalloc, MyRealloc, safefree) ;
@@ -1287,925 +1296,12 @@ my_db_open(
return RETVAL ;
}
-static double
-constant(char * name, int arg)
-{
- errno = 0;
- switch (*name) {
- case 'A':
- break;
- case 'B':
- break;
- case 'C':
- break;
- case 'D':
- if (strEQ(name, "DB_AFTER"))
-#ifdef DB_AFTER
- return DB_AFTER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_APPEND"))
-#ifdef DB_APPEND
- return DB_APPEND;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ARCH_ABS"))
-#ifdef DB_ARCH_ABS
- return DB_ARCH_ABS;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ARCH_DATA"))
-#ifdef DB_ARCH_DATA
- return DB_ARCH_DATA;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ARCH_LOG"))
-#ifdef DB_ARCH_LOG
- return DB_ARCH_LOG;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_BEFORE"))
-#ifdef DB_BEFORE
- return DB_BEFORE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_BTREE"))
- return DB_BTREE;
- if (strEQ(name, "DB_BTREEMAGIC"))
-#ifdef DB_BTREEMAGIC
- return DB_BTREEMAGIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_BTREEOLDVER"))
-#ifdef DB_BTREEOLDVER
- return DB_BTREEOLDVER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_BTREEVERSION"))
-#ifdef DB_BTREEVERSION
- return DB_BTREEVERSION;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CHECKPOINT"))
-#ifdef DB_CHECKPOINT
- return DB_CHECKPOINT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CONSUME"))
-#ifdef DB_CONSUME
- return DB_CONSUME;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CONSUME_WAIT"))
-#ifdef DB_CONSUME_WAIT
- return DB_CONSUME_WAIT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CREATE"))
-#ifdef DB_CREATE
- return DB_CREATE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CURLSN"))
-#ifdef DB_CURLSN
- return DB_CURLSN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_CURRENT"))
-#ifdef DB_CURRENT
- return DB_CURRENT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DBT_MALLOC"))
-#ifdef DB_DBT_MALLOC
- return DB_DBT_MALLOC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DBT_PARTIAL"))
-#ifdef DB_DBT_PARTIAL
- return DB_DBT_PARTIAL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DBT_USERMEM"))
-#ifdef DB_DBT_USERMEM
- return DB_DBT_USERMEM;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DELETED"))
-#ifdef DB_DELETED
- return DB_DELETED;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DELIMITER"))
-#ifdef DB_DELIMITER
- return DB_DELIMITER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DUP"))
-#ifdef DB_DUP
- return DB_DUP;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_DUPSORT"))
-#ifdef DB_DUPSORT
- return DB_DUPSORT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ENV_APPINIT"))
-#ifdef DB_ENV_APPINIT
- return DB_ENV_APPINIT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ENV_STANDALONE"))
-#ifdef DB_ENV_STANDALONE
- return DB_ENV_STANDALONE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_ENV_THREAD"))
-#ifdef DB_ENV_THREAD
- return DB_ENV_THREAD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_EXCL"))
-#ifdef DB_EXCL
- return DB_EXCL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_FILE_ID_LEN"))
-#ifdef DB_FILE_ID_LEN
- return DB_FILE_ID_LEN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_FIRST"))
-#ifdef DB_FIRST
- return DB_FIRST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_FIXEDLEN"))
-#ifdef DB_FIXEDLEN
- return DB_FIXEDLEN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_FLUSH"))
-#ifdef DB_FLUSH
- return DB_FLUSH;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_FORCE"))
-#ifdef DB_FORCE
- return DB_FORCE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_GET_BOTH"))
-#ifdef DB_GET_BOTH
- return DB_GET_BOTH;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_GET_RECNO"))
-#ifdef DB_GET_RECNO
- return DB_GET_RECNO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_HASH"))
- return DB_HASH;
- if (strEQ(name, "DB_HASHMAGIC"))
-#ifdef DB_HASHMAGIC
- return DB_HASHMAGIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_HASHOLDVER"))
-#ifdef DB_HASHOLDVER
- return DB_HASHOLDVER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_HASHVERSION"))
-#ifdef DB_HASHVERSION
- return DB_HASHVERSION;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INCOMPLETE"))
-#ifdef DB_INCOMPLETE
- return DB_INCOMPLETE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INIT_CDB"))
-#ifdef DB_INIT_CDB
- return DB_INIT_CDB;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INIT_LOCK"))
-#ifdef DB_INIT_LOCK
- return DB_INIT_LOCK;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INIT_LOG"))
-#ifdef DB_INIT_LOG
- return DB_INIT_LOG;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INIT_MPOOL"))
-#ifdef DB_INIT_MPOOL
- return DB_INIT_MPOOL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_INIT_TXN"))
-#ifdef DB_INIT_TXN
- return DB_INIT_TXN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_JOIN_ITEM"))
-#ifdef DB_JOIN_ITEM
- return DB_JOIN_ITEM;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_JOINENV"))
-#ifdef DB_JOINENV
- return DB_JOINENV;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_KEYEMPTY"))
-#ifdef DB_KEYEMPTY
- return DB_KEYEMPTY;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_KEYEXIST"))
-#ifdef DB_KEYEXIST
- return DB_KEYEXIST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_KEYFIRST"))
-#ifdef DB_KEYFIRST
- return DB_KEYFIRST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_KEYLAST"))
-#ifdef DB_KEYLAST
- return DB_KEYLAST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LAST"))
-#ifdef DB_LAST
- return DB_LAST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCKMAGIC"))
-#ifdef DB_LOCKMAGIC
- return DB_LOCKMAGIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCKVERSION"))
-#ifdef DB_LOCKVERSION
- return DB_LOCKVERSION;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_CONFLICT"))
-#ifdef DB_LOCK_CONFLICT
- return DB_LOCK_CONFLICT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_DEADLOCK"))
-#ifdef DB_LOCK_DEADLOCK
- return DB_LOCK_DEADLOCK;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_DEFAULT"))
-#ifdef DB_LOCK_DEFAULT
- return DB_LOCK_DEFAULT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_GET"))
- return DB_LOCK_GET;
- if (strEQ(name, "DB_LOCK_NORUN"))
-#ifdef DB_LOCK_NORUN
- return DB_LOCK_NORUN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_NOTGRANTED"))
-#ifdef DB_LOCK_NOTGRANTED
- return DB_LOCK_NOTGRANTED;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_NOTHELD"))
-#ifdef DB_LOCK_NOTHELD
- return DB_LOCK_NOTHELD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_NOWAIT"))
-#ifdef DB_LOCK_NOWAIT
- return DB_LOCK_NOWAIT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_OLDEST"))
-#ifdef DB_LOCK_OLDEST
- return DB_LOCK_OLDEST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_RANDOM"))
-#ifdef DB_LOCK_RANDOM
- return DB_LOCK_RANDOM;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_RIW_N"))
-#ifdef DB_LOCK_RIW_N
- return DB_LOCK_RIW_N;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_RW_N"))
-#ifdef DB_LOCK_RW_N
- return DB_LOCK_RW_N;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOCK_YOUNGEST"))
-#ifdef DB_LOCK_YOUNGEST
- return DB_LOCK_YOUNGEST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOGMAGIC"))
-#ifdef DB_LOGMAGIC
- return DB_LOGMAGIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_LOGOLDVER"))
-#ifdef DB_LOGOLDVER
- return DB_LOGOLDVER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MAX_PAGES"))
-#ifdef DB_MAX_PAGES
- return DB_MAX_PAGES;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MAX_RECORDS"))
-#ifdef DB_MAX_RECORDS
- return DB_MAX_RECORDS;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_CLEAN"))
-#ifdef DB_MPOOL_CLEAN
- return DB_MPOOL_CLEAN;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_CREATE"))
-#ifdef DB_MPOOL_CREATE
- return DB_MPOOL_CREATE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_DIRTY"))
-#ifdef DB_MPOOL_DIRTY
- return DB_MPOOL_DIRTY;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_DISCARD"))
-#ifdef DB_MPOOL_DISCARD
- return DB_MPOOL_DISCARD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_LAST"))
-#ifdef DB_MPOOL_LAST
- return DB_MPOOL_LAST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_NEW"))
-#ifdef DB_MPOOL_NEW
- return DB_MPOOL_NEW;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MPOOL_PRIVATE"))
-#ifdef DB_MPOOL_PRIVATE
- return DB_MPOOL_PRIVATE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MUTEXDEBUG"))
-#ifdef DB_MUTEXDEBUG
- return DB_MUTEXDEBUG;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_MUTEXLOCKS"))
-#ifdef DB_MUTEXLOCKS
- return DB_MUTEXLOCKS;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NEEDSPLIT"))
-#ifdef DB_NEEDSPLIT
- return DB_NEEDSPLIT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NEXT"))
-#ifdef DB_NEXT
- return DB_NEXT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NEXT_DUP"))
-#ifdef DB_NEXT_DUP
- return DB_NEXT_DUP;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NOMMAP"))
-#ifdef DB_NOMMAP
- return DB_NOMMAP;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NOOVERWRITE"))
-#ifdef DB_NOOVERWRITE
- return DB_NOOVERWRITE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NOSYNC"))
-#ifdef DB_NOSYNC
- return DB_NOSYNC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_NOTFOUND"))
-#ifdef DB_NOTFOUND
- return DB_NOTFOUND;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_PAD"))
-#ifdef DB_PAD
- return DB_PAD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_PAGEYIELD"))
-#ifdef DB_PAGEYIELD
- return DB_PAGEYIELD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_POSITION"))
-#ifdef DB_POSITION
- return DB_POSITION;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_PREV"))
-#ifdef DB_PREV
- return DB_PREV;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_PRIVATE"))
-#ifdef DB_PRIVATE
- return DB_PRIVATE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_QUEUE"))
- return DB_QUEUE;
- if (strEQ(name, "DB_RDONLY"))
-#ifdef DB_RDONLY
- return DB_RDONLY;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RECNO"))
- return DB_RECNO;
- if (strEQ(name, "DB_RECNUM"))
-#ifdef DB_RECNUM
- return DB_RECNUM;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RECORDCOUNT"))
-#ifdef DB_RECORDCOUNT
- return DB_RECORDCOUNT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RECOVER"))
-#ifdef DB_RECOVER
- return DB_RECOVER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RECOVER_FATAL"))
-#ifdef DB_RECOVER_FATAL
- return DB_RECOVER_FATAL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_REGISTERED"))
-#ifdef DB_REGISTERED
- return DB_REGISTERED;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RENUMBER"))
-#ifdef DB_RENUMBER
- return DB_RENUMBER;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RMW"))
-#ifdef DB_RMW
- return DB_RMW;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_RUNRECOVERY"))
-#ifdef DB_RUNRECOVERY
- return DB_RUNRECOVERY;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SEQUENTIAL"))
-#ifdef DB_SEQUENTIAL
- return DB_SEQUENTIAL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SET"))
-#ifdef DB_SET
- return DB_SET;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SET_RANGE"))
-#ifdef DB_SET_RANGE
- return DB_SET_RANGE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SET_RECNO"))
-#ifdef DB_SET_RECNO
- return DB_SET_RECNO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SNAPSHOT"))
-#ifdef DB_SNAPSHOT
- return DB_SNAPSHOT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_SWAPBYTES"))
-#ifdef DB_SWAPBYTES
- return DB_SWAPBYTES;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TEMPORARY"))
-#ifdef DB_TEMPORARY
- return DB_TEMPORARY;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_THREAD"))
-#ifdef DB_THREAD
- return DB_THREAD;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TRUNCATE"))
-#ifdef DB_TRUNCATE
- return DB_TRUNCATE;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXNMAGIC"))
-#ifdef DB_TXNMAGIC
- return DB_TXNMAGIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXNVERSION"))
-#ifdef DB_TXNVERSION
- return DB_TXNVERSION;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_BACKWARD_ROLL"))
- return DB_TXN_BACKWARD_ROLL;
- if (strEQ(name, "DB_TXN_CKP"))
-#ifdef DB_TXN_CKP
- return DB_TXN_CKP;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_FORWARD_ROLL"))
- return DB_TXN_FORWARD_ROLL;
- if (strEQ(name, "DB_TXN_LOCK_2PL"))
-#ifdef DB_TXN_LOCK_2PL
- return DB_TXN_LOCK_2PL;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOCK_MASK"))
-#ifdef DB_TXN_LOCK_MASK
- return DB_TXN_LOCK_MASK;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOCK_OPTIMIST"))
-#ifdef DB_TXN_LOCK_OPTIMIST
- return DB_TXN_LOCK_OPTIMIST;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOCK_OPTIMISTIC"))
-#ifdef DB_TXN_LOCK_OPTIMISTIC
- return DB_TXN_LOCK_OPTIMISTIC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOG_MASK"))
-#ifdef DB_TXN_LOG_MASK
- return DB_TXN_LOG_MASK;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOG_REDO"))
-#ifdef DB_TXN_LOG_REDO
- return DB_TXN_LOG_REDO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOG_UNDO"))
-#ifdef DB_TXN_LOG_UNDO
- return DB_TXN_LOG_UNDO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_LOG_UNDOREDO"))
-#ifdef DB_TXN_LOG_UNDOREDO
- return DB_TXN_LOG_UNDOREDO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_NOSYNC"))
-#ifdef DB_TXN_NOSYNC
- return DB_TXN_NOSYNC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_NOWAIT"))
-#ifdef DB_TXN_NOWAIT
- return DB_TXN_NOWAIT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_OPENFILES"))
- return DB_TXN_OPENFILES;
- if (strEQ(name, "DB_TXN_REDO"))
-#ifdef DB_TXN_REDO
- return DB_TXN_REDO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_SYNC"))
-#ifdef DB_TXN_SYNC
- return DB_TXN_SYNC;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_TXN_UNDO"))
-#ifdef DB_TXN_UNDO
- return DB_TXN_UNDO;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_UNKNOWN"))
- return DB_UNKNOWN;
- if (strEQ(name, "DB_USE_ENVIRON"))
-#ifdef DB_USE_ENVIRON
- return DB_USE_ENVIRON;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_USE_ENVIRON_ROOT"))
-#ifdef DB_USE_ENVIRON_ROOT
- return DB_USE_ENVIRON_ROOT;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_VERSION_MAJOR"))
-#ifdef DB_VERSION_MAJOR
- return DB_VERSION_MAJOR;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_VERSION_MINOR"))
-#ifdef DB_VERSION_MINOR
- return DB_VERSION_MINOR;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_VERSION_PATCH"))
-#ifdef DB_VERSION_PATCH
- return DB_VERSION_PATCH;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "DB_WRITECURSOR"))
-#ifdef DB_WRITECURSOR
- return DB_WRITECURSOR;
-#else
- goto not_there;
-#endif
- break;
- case 'E':
- break;
- case 'F':
- break;
- case 'G':
- break;
- case 'H':
- break;
- case 'I':
- break;
- case 'J':
- break;
- case 'K':
- break;
- case 'L':
- break;
- case 'M':
- break;
- case 'N':
- break;
- case 'O':
- break;
- case 'P':
- break;
- case 'Q':
- break;
- case 'R':
- break;
- case 'S':
- break;
- case 'T':
- break;
- case 'U':
- break;
- case 'V':
- break;
- case 'W':
- break;
- case 'X':
- break;
- case 'Y':
- break;
- case 'Z':
- break;
- case 'a':
- break;
- case 'b':
- break;
- case 'c':
- break;
- case 'd':
- break;
- case 'e':
- break;
- case 'f':
- break;
- case 'g':
- break;
- case 'h':
- break;
- case 'i':
- break;
- case 'j':
- break;
- case 'k':
- break;
- case 'l':
- break;
- case 'm':
- break;
- case 'n':
- break;
- case 'o':
- break;
- case 'p':
- break;
- case 'q':
- break;
- case 'r':
- break;
- case 's':
- break;
- case 't':
- break;
- case 'u':
- break;
- case 'v':
- break;
- case 'w':
- break;
- case 'x':
- break;
- case 'y':
- break;
- case 'z':
- break;
- }
- errno = EINVAL;
- return 0;
-
-not_there:
- errno = ENOENT;
- return 0;
-}
+#include "constants.h"
MODULE = BerkeleyDB PACKAGE = BerkeleyDB PREFIX = env_
-char *
-DB_VERSION_STRING()
- CODE:
- RETVAL = DB_VERSION_STRING ;
- OUTPUT:
- RETVAL
-
-
-double
-constant(name,arg)
- char * name
- int arg
+INCLUDE: constants.xs
#define env_db_version(maj, min, patch) db_version(&maj, &min, &patch)
char *
@@ -2368,7 +1464,16 @@ _db_appinit(self, ref)
Trace(("set_lk_detect [%d] returned %s\n",
lk_detect, my_db_strerror(status)));
}
-#ifdef AT_LEAST_DB_3_1
+#ifdef AT_LEAST_DB_4
+ /* set the server */
+ if (server && status == 0)
+ {
+ status = env->set_rpc_server(env, NULL, server, 0, 0, 0);
+ Trace(("ENV->set_rpc_server server = %s returned %s\n", server,
+ my_db_strerror(status))) ;
+ }
+#else
+# if defined(AT_LEAST_DB_3_1) && ! defined(AT_LEAST_DB_4)
/* set the server */
if (server && status == 0)
{
@@ -2376,6 +1481,7 @@ _db_appinit(self, ref)
Trace(("ENV->set_server server = %s returned %s\n", server,
my_db_strerror(status))) ;
}
+# endif
#endif
if (status == 0)
{
@@ -2422,6 +1528,38 @@ _db_appinit(self, ref)
OUTPUT:
RETVAL
+void
+log_archive(env, flags=0)
+ u_int32_t flags
+ BerkeleyDB::Env env
+ PPCODE:
+ {
+ char ** list;
+ char ** file;
+ AV * av;
+#ifndef AT_LEAST_DB_3
+ softCrash("log_archive needs at least Berkeley DB 3.x.x");
+#else
+# ifdef AT_LEAST_DB_4
+ env->Status = env->Env->log_archive(env->Env, &list, flags) ;
+# else
+# ifdef AT_LEAST_DB_3_3
+ env->Status = log_archive(env->Env, &list, flags) ;
+# else
+ env->Status = log_archive(env->Env, &list, flags, safemalloc) ;
+# endif
+# endif
+ if (env->Status == 0 && list != NULL)
+ {
+ for (file = list; *file != NULL; ++file)
+ {
+ XPUSHs(sv_2mortal(newSVpv(*file, 0))) ;
+ }
+ safefree(list);
+ }
+#endif
+ }
+
BerkeleyDB::Txn::Raw
_txn_begin(env, pid=NULL, flags=0)
u_int32_t flags
@@ -2444,7 +1582,11 @@ _txn_begin(env, pid=NULL, flags=0)
#if DB_VERSION_MAJOR == 2
txn_begin(env->Env->tx_info, p_id, &txn) ;
#else
+# ifdef AT_LEAST_DB_4
+ env->Env->txn_begin(env->Env, p_id, &txn, flags) ;
+# else
txn_begin(env->Env, p_id, &txn, flags) ;
+# endif
#endif
if (env->TxnMgrStatus == 0) {
ZMALLOC(RETVAL, BerkeleyDB_Txn_type) ;
@@ -2461,19 +1603,24 @@ _txn_begin(env, pid=NULL, flags=0)
#if DB_VERSION_MAJOR == 2
-# define env_txn_checkpoint(e,k,m) txn_checkpoint(e->Env->tx_info, k, m)
+# define env_txn_checkpoint(e,k,m,f) txn_checkpoint(e->Env->tx_info, k, m)
#else /* DB 3.0 or better */
-# ifdef AT_LEAST_DB_3_1
-# define env_txn_checkpoint(e,k,m) txn_checkpoint(e->Env, k, m, 0)
+# ifdef AT_LEAST_DB_4
+# define env_txn_checkpoint(e,k,m,f) e->Env->txn_checkpoint(e->Env, k, m, f)
# else
-# define env_txn_checkpoint(e,k,m) txn_checkpoint(e->Env, k, m)
+# ifdef AT_LEAST_DB_3_1
+# define env_txn_checkpoint(e,k,m,f) txn_checkpoint(e->Env, k, m, 0)
+# else
+# define env_txn_checkpoint(e,k,m,f) txn_checkpoint(e->Env, k, m)
+# endif
# endif
#endif
DualType
-env_txn_checkpoint(env, kbyte, min)
+env_txn_checkpoint(env, kbyte, min, flags=0)
BerkeleyDB::Env env
long kbyte
long min
+ u_int32_t flags
HV *
txn_stat(env)
@@ -2482,14 +1629,18 @@ txn_stat(env)
CODE:
{
DB_TXN_STAT * stat ;
-#ifdef AT_LEAST_DB_3_3
- if(txn_stat(env->Env, &stat) == 0) {
+#ifdef AT_LEAST_DB_4
+ if(env->Env->txn_stat(env->Env, &stat, 0) == 0) {
#else
-#if DB_VERSION_MAJOR == 2
+# ifdef AT_LEAST_DB_3_3
+ if(txn_stat(env->Env, &stat) == 0) {
+# else
+# if DB_VERSION_MAJOR == 2
if(txn_stat(env->Env->tx_info, &stat, safemalloc) == 0) {
-#else
+# else
if(txn_stat(env->Env, &stat, safemalloc) == 0) {
-#endif
+# endif
+# endif
#endif
RETVAL = (HV*)sv_2mortal((SV*)newHV()) ;
hv_store_iv(RETVAL, "st_time_ckp", stat->st_time_ckp) ;
@@ -2718,11 +1869,15 @@ set_mutexlocks(env, do_lock)
#ifndef AT_LEAST_DB_3
softCrash("$env->set_setmutexlocks needs Berkeley DB 3.0 or better") ;
#else
-#if defined(AT_LEAST_DB_3_2_6) || defined(IS_DB_3_0_x)
+# ifdef AT_LEAST_DB_4
+ RETVAL = env->Status = env->Env->set_flags(env->Env, DB_NOLOCKING, 1);
+# else
+# if defined(AT_LEAST_DB_3_2_6) || defined(IS_DB_3_0_x)
RETVAL = env->Status = env->Env->set_mutexlocks(env->Env, do_lock);
-#else /* DB 3.1 or 3.2.3 */
+# else /* DB 3.1 or 3.2.3 */
RETVAL = env->Status = db_env_set_mutexlocks(do_lock);
-#endif
+# endif
+# endif
#endif
OUTPUT:
RETVAL
@@ -3776,7 +2931,11 @@ _txn_begin(txnmgr, pid=NULL, flags=0)
#if DB_VERSION_MAJOR == 2
txn_begin(txnmgr->env->Env->tx_info, p_id, &txn) ;
#else
+# ifdef AT_LEAST_DB_4
+ txnmgr->env->Env->txn_begin(txnmgr->env->Env, p_id, &txn, flags) ;
+# else
txn_begin(txnmgr->env->Env, p_id, &txn, flags) ;
+# endif
#endif
if (txnmgr->env->TxnMgrStatus == 0) {
ZMALLOC(RETVAL, BerkeleyDB_Txn_type) ;
@@ -3816,19 +2975,24 @@ txn_close(txnp)
#if DB_VERSION_MAJOR == 2
-# define xx_txn_checkpoint(t,k,m) txn_checkpoint(t->env->Env->tx_info, k, m)
+# define xx_txn_checkpoint(t,k,m,f) txn_checkpoint(t->env->Env->tx_info, k, m)
#else
-# ifdef AT_LEAST_DB_3_1
-# define xx_txn_checkpoint(t,k,m) txn_checkpoint(t->env->Env, k, m, 0)
+# ifdef AT_LEAST_DB_4
+# define xx_txn_checkpoint(e,k,m,f) e->env->Env->txn_checkpoint(e->env->Env, k, m, f)
# else
-# define xx_txn_checkpoint(t,k,m) txn_checkpoint(t->env->Env, k, m)
+# ifdef AT_LEAST_DB_3_1
+# define xx_txn_checkpoint(t,k,m,f) txn_checkpoint(t->env->Env, k, m, 0)
+# else
+# define xx_txn_checkpoint(t,k,m,f) txn_checkpoint(t->env->Env, k, m)
+# endif
# endif
#endif
DualType
-xx_txn_checkpoint(txnp, kbyte, min)
+xx_txn_checkpoint(txnp, kbyte, min, flags=0)
BerkeleyDB::TxnMgr txnp
long kbyte
long min
+ u_int32_t flags
HV *
txn_stat(txnp)
@@ -3837,14 +3001,18 @@ txn_stat(txnp)
CODE:
{
DB_TXN_STAT * stat ;
-#ifdef AT_LEAST_DB_3_3
- if(txn_stat(txnp->env->Env, &stat) == 0) {
+#ifdef AT_LEAST_DB_4
+ if(txnp->env->Env->txn_stat(txnp->env->Env, &stat, 0) == 0) {
#else
-#if DB_VERSION_MAJOR == 2
+# ifdef AT_LEAST_DB_3_3
+ if(txn_stat(txnp->env->Env, &stat) == 0) {
+# else
+# if DB_VERSION_MAJOR == 2
if(txn_stat(txnp->env->Env->tx_info, &stat, safemalloc) == 0) {
-#else
+# else
if(txn_stat(txnp->env->Env, &stat, safemalloc) == 0) {
-#endif
+# endif
+# endif
#endif
RETVAL = (HV*)sv_2mortal((SV*)newHV()) ;
hv_store_iv(RETVAL, "st_time_ckp", stat->st_time_ckp) ;
@@ -3892,7 +3060,11 @@ _DESTROY(tid)
CODE:
Trace(("In BerkeleyDB::Txn::_DESTROY txn [%d] active [%d] dirty=%d\n", tid->txn, tid->active, PL_dirty)) ;
if (tid->active)
+#ifdef AT_LEAST_DB_4
+ tid->txn->abort(tid->txn) ;
+#else
txn_abort(tid->txn) ;
+#endif
RETVAL = (int)tid ;
hash_delete("BerkeleyDB::Term::Txn", (char *)tid) ;
Safefree(tid) ;
@@ -3908,10 +3080,14 @@ xx_txn_unlink(dir, force, dbenv)
BerkeleyDB::Env dbenv
NOT_IMPLEMENTED_YET
-#ifdef AT_LEAST_DB_3_3
-#define xx_txn_prepare(t) (t->Status = txn_prepare(t->txn, 0))
+#ifdef AT_LEAST_DB_4
+# define xx_txn_prepare(t) (t->Status = t->txn->prepare(t->txn, 0))
#else
-#define xx_txn_prepare(t) (t->Status = txn_prepare(t->txn))
+# ifdef AT_LEAST_DB_3_3
+# define xx_txn_prepare(t) (t->Status = txn_prepare(t->txn, 0))
+# else
+# define xx_txn_prepare(t) (t->Status = txn_prepare(t->txn))
+# endif
#endif
DualType
xx_txn_prepare(tid)
@@ -3919,10 +3095,14 @@ xx_txn_prepare(tid)
INIT:
ckActive_Transaction(tid->active) ;
-#if DB_VERSION_MAJOR == 2
-# define _txn_commit(t,flags) (t->Status = txn_commit(t->txn))
+#ifdef AT_LEAST_DB_4
+# define _txn_commit(t,flags) (t->Status = t->txn->commit(t->txn, flags))
#else
-# define _txn_commit(t, flags) (t->Status = txn_commit(t->txn, flags))
+# if DB_VERSION_MAJOR == 2
+# define _txn_commit(t,flags) (t->Status = txn_commit(t->txn))
+# else
+# define _txn_commit(t, flags) (t->Status = txn_commit(t->txn, flags))
+# endif
#endif
DualType
_txn_commit(tid, flags=0)
@@ -3933,7 +3113,11 @@ _txn_commit(tid, flags=0)
hash_delete("BerkeleyDB::Term::Txn", (char *)tid) ;
tid->active = FALSE ;
-#define _txn_abort(t) (t->Status = txn_abort(t->txn))
+#ifdef AT_LEAST_DB_4
+# define _txn_abort(t) (t->Status = t->txn->abort(t->txn))
+#else
+# define _txn_abort(t) (t->Status = txn_abort(t->txn))
+#endif
DualType
_txn_abort(tid)
BerkeleyDB::Txn tid
@@ -3942,7 +3126,29 @@ _txn_abort(tid)
hash_delete("BerkeleyDB::Term::Txn", (char *)tid) ;
tid->active = FALSE ;
-#define xx_txn_id(t) txn_id(t->txn)
+#ifdef AT_LEAST_DB_4
+# define _txn_discard(t,f) (t->Status = t->txn->discard(t->txn, f))
+#else
+# ifdef AT_LEAST_DB_3_3_4
+# define _txn_discard(t,f) (t->Status = txn_discard(t->txn, f))
+# else
+# define _txn_discard(t,f) (int)softCrash("txn_discard needs Berkeley DB 3.3.4 or better") ;
+# endif
+#endif
+DualType
+_txn_discard(tid, flags=0)
+ BerkeleyDB::Txn tid
+ u_int32_t flags
+ INIT:
+ ckActive_Transaction(tid->active) ;
+ hash_delete("BerkeleyDB::Term::Txn", (char *)tid) ;
+ tid->active = FALSE ;
+
+#ifdef AT_LEAST_DB_4
+# define xx_txn_id(t) t->txn->id(t->txn)
+#else
+# define xx_txn_id(t) txn_id(t->txn)
+#endif
u_int32_t
xx_txn_id(tid)
BerkeleyDB::Txn tid
@@ -3992,12 +3198,13 @@ FIRSTKEY(db)
int
NEXTKEY(db, key)
BerkeleyDB::Common db
- DBTKEY key
+ DBTKEY key = NO_INIT
CODE:
{
DBT value ;
CurrentDB = db ;
+ DBT_clear(key) ;
DBT_clear(value) ;
key.flags = 0 ;
RETVAL = (db->Status) =
diff --git a/db/perl/BerkeleyDB/Changes b/db/perl/BerkeleyDB/Changes
index f647bea85..732dbac66 100644
--- a/db/perl/BerkeleyDB/Changes
+++ b/db/perl/BerkeleyDB/Changes
@@ -1,5 +1,11 @@
Revision history for Perl extension BerkeleyDB.
+0.17 26 23 September 2001
+ * Fixed a bug in BerkeleyDB::Recno - reported by Niklas Paulsson.
+ * Added log_archive - patch supplied by Benjamin Holzman
+ * Added txn_discard
+ * Builds with Berkeley DB 4.0.x
+
0.16 26 1 August 2001
* added support for Berkeley DB 3.3.x (but no support for any of the
new features just yet)
diff --git a/db/perl/BerkeleyDB/MANIFEST b/db/perl/BerkeleyDB/MANIFEST
index ed8450f6f..6e9857be4 100644
--- a/db/perl/BerkeleyDB/MANIFEST
+++ b/db/perl/BerkeleyDB/MANIFEST
@@ -6,6 +6,8 @@ BerkeleyDB/Btree.pm
BerkeleyDB/Hash.pm
Changes
config.in
+constants.h
+constants.xs
dbinfo
hints/solaris.pl
hints/irix_6_5.pl
diff --git a/db/perl/BerkeleyDB/Makefile.PL b/db/perl/BerkeleyDB/Makefile.PL
index c99283b20..dbf0f2c41 100644
--- a/db/perl/BerkeleyDB/Makefile.PL
+++ b/db/perl/BerkeleyDB/Makefile.PL
@@ -63,8 +63,14 @@ sub MY::postamble {
$(NAME).pod: $(NAME).pod.P t/examples.t.T t/examples3.t.T mkpod
perl ./mkpod
-$(NAME).xs: typemap
- @$(TOUCH) $(NAME).xs
+$(NAME).xs: constants.h constants.xs typemap
+ $(TOUCH) $(NAME).xs
+
+constants.h constants.xs: mkconsts
+ bleedperl mkconsts xs
+
+$(NAME).pm: mkconsts
+ bleedperl mkconsts pm $(NAME).pm > $(NAME).pm.tmp && mv $(NAME).pm.tmp $(NAME).pm
Makefile: config.in
diff --git a/db/perl/BerkeleyDB/README b/db/perl/BerkeleyDB/README
index 5784a1954..8640949f3 100644
--- a/db/perl/BerkeleyDB/README
+++ b/db/perl/BerkeleyDB/README
@@ -1,8 +1,8 @@
BerkeleyDB
- Version 0.16
+ Version 0.17
- 1st August 2001
+ 22nd October 2001
Copyright (c) 1997-2001 Paul Marquess. All rights reserved. This
program is free software; you can redistribute it and/or modify
@@ -13,8 +13,9 @@ DESCRIPTION
-----------
BerkeleyDB is a module which allows Perl programs to make use of the
-facilities provided by Berkeley DB version 2 or 3. (Note: if you want
-to use version 1 of Berkeley DB with Perl you need the DB_File module).
+facilities provided by Berkeley DB version 2 or greater. (Note: if
+you want to use version 1 of Berkeley DB with Perl you need the DB_File
+module).
Berkeley DB is a C library which provides a consistent interface to a
number of database formats. BerkeleyDB provides an interface to all
diff --git a/db/perl/BerkeleyDB/config.in b/db/perl/BerkeleyDB/config.in
index 1718297d8..ab3c026c1 100644
--- a/db/perl/BerkeleyDB/config.in
+++ b/db/perl/BerkeleyDB/config.in
@@ -7,24 +7,26 @@
# Change the path below to point to the directory where db.h is
# installed on your system.
-#INCLUDE = /usr/local/include
-INCLUDE = /usr/local/BerkeleyDB/include
-#INCLUDE = ./libraries/2.7.5
-#INCLUDE = ./libraries/3.0.55
-#INCLUDE = ./libraries/3.1.17
-#INCLUDE = ./libraries/3.3.11
+INCLUDE = /usr/local/include
+#INCLUDE = /usr/local/BerkeleyDB/include
+#INCLUDE = ./libraries/2.7.5/include
+#INCLUDE = ./libraries/3.0.55/include
+#INCLUDE = ./libraries/3.1.17/include
+#INCLUDE = ./libraries/3.3.11/include
+#INCLUDE = ./libraries/4.0.7/include
# 2. Where is libdb?
#
# Change the path below to point to the directory where libdb is
# installed on your system.
-#LIB = /usr/local/lib
-LIB = /usr/local/BerkeleyDB/lib
-#LIB = ./libraries/2.7.5
-#LIB = ./libraries/3.0.55
-#LIB = ./libraries/3.1.17
-#LIB = ./libraries/3.3.11
+LIB = /usr/local/lib
+#LIB = /usr/local/BerkeleyDB/lib
+#LIB = ./libraries/2.7.5/lib
+#LIB = ./libraries/3.0.55/lib
+#LIB = ./libraries/3.1.17/lib
+#LIB = ./libraries/3.3.11/lib
+#LIB = ./libraries/4.0.7/lib
# 3. Is the library called libdb?
#
diff --git a/db/perl/BerkeleyDB/mkconsts b/db/perl/BerkeleyDB/mkconsts
index 24ef4fca7..dc90ea970 100644
--- a/db/perl/BerkeleyDB/mkconsts
+++ b/db/perl/BerkeleyDB/mkconsts
@@ -1,211 +1,678 @@
#!/usr/bin/perl
+use ExtUtils::Constant qw(WriteConstants);
+
+use constant DEFINE => 'define' ;
+use constant STRING => 'string' ;
+use constant IGNORE => 'ignore' ;
+
%constants = (
- # Symbol 0 = define, 1 = enum
- DB_AFTER => 0,
- DB_APPEND => 0,
- DB_ARCH_ABS => 0,
- DB_ARCH_DATA => 0,
- DB_ARCH_LOG => 0,
- DB_BEFORE => 0,
- DB_BTREE => 1,
- DB_BTREEMAGIC => 0,
- DB_BTREEOLDVER => 0,
- DB_BTREEVERSION => 0,
- DB_CHECKPOINT => 0,
- DB_CONSUME => 0,
- DB_CREATE => 0,
- DB_CURLSN => 0,
- DB_CURRENT => 0,
- DB_DBT_MALLOC => 0,
- DB_DBT_PARTIAL => 0,
- DB_DBT_USERMEM => 0,
- DB_DELETED => 0,
- DB_DELIMITER => 0,
- DB_DUP => 0,
- DB_DUPSORT => 0,
- DB_ENV_APPINIT => 0,
- DB_ENV_STANDALONE => 0,
- DB_ENV_THREAD => 0,
- DB_EXCL => 0,
- DB_FILE_ID_LEN => 0,
- DB_FIRST => 0,
- DB_FIXEDLEN => 0,
- DB_FLUSH => 0,
- DB_FORCE => 0,
- DB_GET_BOTH => 0,
- DB_GET_RECNO => 0,
- DB_HASH => 1,
- DB_HASHMAGIC => 0,
- DB_HASHOLDVER => 0,
- DB_HASHVERSION => 0,
- DB_INCOMPLETE => 0,
- DB_INIT_CDB => 0,
- DB_INIT_LOCK => 0,
- DB_INIT_LOG => 0,
- DB_INIT_MPOOL => 0,
- DB_INIT_TXN => 0,
- DB_JOIN_ITEM => 0,
- DB_KEYEMPTY => 0,
- DB_KEYEXIST => 0,
- DB_KEYFIRST => 0,
- DB_KEYLAST => 0,
- DB_LAST => 0,
- DB_LOCK_CONFLICT => 0,
- DB_LOCK_DEADLOCK => 0,
- DB_LOCK_DEFAULT => 0,
- DB_LOCK_GET => 1,
- DB_LOCK_NORUN => 0,
- DB_LOCK_NOTGRANTED => 0,
- DB_LOCK_NOTHELD => 0,
- DB_LOCK_NOWAIT => 0,
- DB_LOCK_OLDEST => 0,
- DB_LOCK_RANDOM => 0,
- DB_LOCK_RIW_N => 0,
- DB_LOCK_RW_N => 0,
- DB_LOCK_YOUNGEST => 0,
- DB_LOCKMAGIC => 0,
- DB_LOCKVERSION => 0,
- DB_LOGMAGIC => 0,
- DB_LOGOLDVER => 0,
- DB_MAX_PAGES => 0,
- DB_MAX_RECORDS => 0,
- DB_MPOOL_CLEAN => 0,
- DB_MPOOL_CREATE => 0,
- DB_MPOOL_DIRTY => 0,
- DB_MPOOL_DISCARD => 0,
- DB_MPOOL_LAST => 0,
- DB_MPOOL_NEW => 0,
- DB_MPOOL_PRIVATE => 0,
- DB_MUTEXDEBUG => 0,
- DB_MUTEXLOCKS => 0,
- DB_NEEDSPLIT => 0,
- DB_NEXT => 0,
- DB_NEXT_DUP => 0,
- DB_NOMMAP => 0,
- DB_NOOVERWRITE => 0,
- DB_NOSYNC => 0,
- DB_NOTFOUND => 0,
- DB_PAD => 0,
- DB_PAGEYIELD => 0,
- DB_POSITION => 0,
- DB_PREV => 0,
- DB_PRIVATE => 0,
- DB_QUEUE => 1,
- DB_RDONLY => 0,
- DB_RECNO => 1,
- DB_RECNUM => 0,
- DB_RECORDCOUNT => 0,
- DB_RECOVER => 0,
- DB_RECOVER_FATAL => 0,
- DB_REGISTERED => 0,
- DB_RENUMBER => 0,
- DB_RMW => 0,
- DB_RUNRECOVERY => 0,
- DB_SEQUENTIAL => 0,
- DB_SET => 0,
- DB_SET_RANGE => 0,
- DB_SET_RECNO => 0,
- DB_SNAPSHOT => 0,
- DB_SWAPBYTES => 0,
- DB_TEMPORARY => 0,
- DB_THREAD => 0,
- DB_TRUNCATE => 0,
- DB_TXN_ABORT => 1,
- DB_TXN_BACKWARD_ROLL => 1,
- DB_TXN_CKP => 0,
- DB_TXN_FORWARD_ROLL => 1,
- DB_TXN_LOCK_2PL => 0,
- DB_TXN_LOCK_MASK => 0,
- DB_TXN_LOCK_OPTIMISTIC => 0,
- DB_TXN_LOG_MASK => 0,
- DB_TXN_LOG_REDO => 0,
- DB_TXN_LOG_UNDO => 0,
- DB_TXN_LOG_UNDOREDO => 0,
- DB_TXN_NOSYNC => 0,
- DB_TXN_NOWAIT => 0,
- DB_TXN_SYNC => 0,
- DB_TXN_OPENFILES => 1,
- DB_TXN_REDO => 0,
- DB_TXN_UNDO => 0,
- DB_TXNMAGIC => 0,
- DB_TXNVERSION => 0,
- DB_TXN_LOCK_OPTIMIST => 0,
- DB_UNKNOWN => 1,
- DB_USE_ENVIRON => 0,
- DB_USE_ENVIRON_ROOT => 0,
- DB_VERSION_MAJOR => 0,
- DB_VERSION_MINOR => 0,
- DB_VERSION_PATCH => 0,
- DB_WRITECURSOR => 0,
+
+ #########
+ # 2.0.0
+ #########
+
+ DBM_INSERT => IGNORE,
+ DBM_REPLACE => IGNORE,
+ DBM_SUFFIX => IGNORE,
+ DB_AFTER => DEFINE,
+ DB_AM_DUP => IGNORE,
+ DB_AM_INMEM => IGNORE,
+ DB_AM_LOCKING => IGNORE,
+ DB_AM_LOGGING => IGNORE,
+ DB_AM_MLOCAL => IGNORE,
+ DB_AM_PGDEF => IGNORE,
+ DB_AM_RDONLY => IGNORE,
+ DB_AM_RECOVER => IGNORE,
+ DB_AM_SWAP => IGNORE,
+ DB_AM_TXN => IGNORE,
+ DB_APP_INIT => DEFINE,
+ DB_BEFORE => DEFINE,
+ DB_BTREEMAGIC => DEFINE,
+ DB_BTREEVERSION => DEFINE,
+ DB_BT_DELIMITER => IGNORE,
+ DB_BT_EOF => IGNORE,
+ DB_BT_FIXEDLEN => IGNORE,
+ DB_BT_PAD => IGNORE,
+ DB_BT_SNAPSHOT => IGNORE,
+ DB_CHECKPOINT => DEFINE,
+ DB_CREATE => DEFINE,
+ DB_CURRENT => DEFINE,
+ DB_DBT_INTERNAL => IGNORE,
+ DB_DBT_MALLOC => IGNORE,
+ DB_DBT_PARTIAL => IGNORE,
+ DB_DBT_USERMEM => IGNORE,
+ DB_DELETED => DEFINE,
+ DB_DELIMITER => DEFINE,
+ DB_DUP => DEFINE,
+ DB_EXCL => DEFINE,
+ DB_FIRST => DEFINE,
+ DB_FIXEDLEN => DEFINE,
+ DB_FLUSH => DEFINE,
+ DB_HASHMAGIC => DEFINE,
+ DB_HASHVERSION => DEFINE,
+ DB_HS_DIRTYMETA => IGNORE,
+ DB_INCOMPLETE => DEFINE,
+ DB_INIT_LOCK => DEFINE,
+ DB_INIT_LOG => DEFINE,
+ DB_INIT_MPOOL => DEFINE,
+ DB_INIT_TXN => DEFINE,
+ DB_KEYEXIST => DEFINE,
+ DB_KEYFIRST => DEFINE,
+ DB_KEYLAST => DEFINE,
+ DB_LAST => DEFINE,
+ DB_LOCKMAGIC => DEFINE,
+ DB_LOCKVERSION => DEFINE,
+ DB_LOCK_DEADLOCK => DEFINE,
+ DB_LOCK_NOTGRANTED => DEFINE,
+ DB_LOCK_NOTHELD => DEFINE,
+ DB_LOCK_NOWAIT => DEFINE,
+ DB_LOCK_RIW_N => DEFINE,
+ DB_LOCK_RW_N => DEFINE,
+ DB_LOGMAGIC => DEFINE,
+ DB_LOGVERSION => DEFINE,
+ DB_MAX_PAGES => DEFINE,
+ DB_MAX_RECORDS => DEFINE,
+ DB_MPOOL_CLEAN => DEFINE,
+ DB_MPOOL_CREATE => DEFINE,
+ DB_MPOOL_DIRTY => DEFINE,
+ DB_MPOOL_DISCARD => DEFINE,
+ DB_MPOOL_LAST => DEFINE,
+ DB_MPOOL_NEW => DEFINE,
+ DB_MPOOL_PRIVATE => DEFINE,
+ DB_MUTEXDEBUG => DEFINE,
+ DB_NEEDSPLIT => DEFINE,
+ DB_NEXT => DEFINE,
+ DB_NOOVERWRITE => DEFINE,
+ DB_NORECURSE => DEFINE,
+ DB_NOSYNC => DEFINE,
+ DB_NOTFOUND => DEFINE,
+ DB_PAD => DEFINE,
+ DB_PREV => DEFINE,
+ DB_RDONLY => DEFINE,
+ DB_REGISTERED => DEFINE,
+ DB_RE_MODIFIED => IGNORE,
+ DB_SET => DEFINE,
+ DB_SET_RANGE => DEFINE,
+ DB_SNAPSHOT => DEFINE,
+ DB_SWAPBYTES => DEFINE,
+ DB_TRUNCATE => DEFINE,
+ DB_TXNMAGIC => DEFINE,
+ DB_TXNVERSION => DEFINE,
+ DB_TXN_BACKWARD_ROLL => DEFINE,
+ DB_TXN_FORWARD_ROLL => DEFINE,
+ DB_TXN_LOCK_2PL => DEFINE,
+ DB_TXN_LOCK_MASK => DEFINE,
+ DB_TXN_LOCK_OPTIMISTIC => DEFINE,
+ DB_TXN_LOG_MASK => DEFINE,
+ DB_TXN_LOG_REDO => DEFINE,
+ DB_TXN_LOG_UNDO => DEFINE,
+ DB_TXN_LOG_UNDOREDO => DEFINE,
+ DB_TXN_OPENFILES => DEFINE,
+ DB_TXN_REDO => DEFINE,
+ DB_TXN_UNDO => DEFINE,
+ DB_USE_ENVIRON => DEFINE,
+ DB_USE_ENVIRON_ROOT => DEFINE,
+ DB_VERSION_MAJOR => DEFINE,
+ DB_VERSION_MINOR => DEFINE,
+ DB_VERSION_PATCH => DEFINE,
+ DB_VERSION_STRING => STRING,
+ _DB_H_ => IGNORE,
+ __BIT_TYPES_DEFINED__ => IGNORE,
+ const => IGNORE,
+
+ # enum DBTYPE
+ DB_BTREE => '2.0.0',
+ DB_HASH => '2.0.0',
+ DB_RECNO => '2.0.0',
+ DB_UNKNOWN => '2.0.0',
+
+ # enum db_lockop_t
+ DB_LOCK_DUMP => '2.0.0',
+ DB_LOCK_GET => '2.0.0',
+ DB_LOCK_PUT => '2.0.0',
+ DB_LOCK_PUT_ALL => '2.0.0',
+ DB_LOCK_PUT_OBJ => '2.0.0',
+
+ # enum db_lockmode_t
+ DB_LOCK_NG => IGNORE, # 2.0.0
+ DB_LOCK_READ => IGNORE, # 2.0.0
+ DB_LOCK_WRITE => IGNORE, # 2.0.0
+ DB_LOCK_IREAD => IGNORE, # 2.0.0
+ DB_LOCK_IWRITE => IGNORE, # 2.0.0
+ DB_LOCK_IWR => IGNORE, # 2.0.0
+
+ # enum ACTION
+ FIND => IGNORE, # 2.0.0
+ ENTER => IGNORE, # 2.0.0
+
+ #########
+ # 2.0.3
+ #########
+
+ DB_SEQUENTIAL => DEFINE,
+ DB_TEMPORARY => DEFINE,
+
+ #########
+ # 2.1.0
+ #########
+
+ DB_NOMMAP => DEFINE,
+
+ #########
+ # 2.2.6
+ #########
+
+ DB_AM_THREAD => IGNORE,
+ DB_ARCH_ABS => DEFINE,
+ DB_ARCH_DATA => DEFINE,
+ DB_ARCH_LOG => DEFINE,
+ DB_LOCK_CONFLICT => DEFINE,
+ DB_LOCK_DEFAULT => DEFINE,
+ DB_LOCK_NORUN => DEFINE,
+ DB_LOCK_OLDEST => DEFINE,
+ DB_LOCK_RANDOM => DEFINE,
+ DB_LOCK_YOUNGEST => DEFINE,
+ DB_RECOVER => DEFINE,
+ DB_RECOVER_FATAL => DEFINE,
+ DB_THREAD => DEFINE,
+ DB_TXN_NOSYNC => DEFINE,
+
+ #########
+ # 2.3.0
+ #########
+
+ DB_BTREEOLDVER => DEFINE,
+ DB_BT_RECNUM => IGNORE,
+ DB_FILE_ID_LEN => DEFINE,
+ DB_GETREC => DEFINE,
+ DB_HASHOLDVER => DEFINE,
+ DB_KEYEMPTY => DEFINE,
+ DB_LOGOLDVER => DEFINE,
+ DB_RECNUM => DEFINE,
+ DB_RECORDCOUNT => DEFINE,
+ DB_RENUMBER => DEFINE,
+ DB_RE_DELIMITER => IGNORE,
+ DB_RE_FIXEDLEN => IGNORE,
+ DB_RE_PAD => IGNORE,
+ DB_RE_RENUMBER => IGNORE,
+ DB_RE_SNAPSHOT => IGNORE,
+
+ #########
+ # 2.3.1
+ #########
+
+ DB_GET_RECNO => DEFINE,
+ DB_SET_RECNO => DEFINE,
+
+ #########
+ # 2.3.3
+ #########
+
+ DB_APPEND => DEFINE,
+
+ #########
+ # 2.3.6
+ #########
+
+ DB_TXN_CKP => DEFINE,
+
+ #########
+ # 2.3.11
+ #########
+
+ DB_ENV_APPINIT => DEFINE,
+ DB_ENV_STANDALONE => DEFINE,
+ DB_ENV_THREAD => DEFINE,
+
+ #########
+ # 2.3.12
+ #########
+
+ DB_FUNC_CALLOC => IGNORE,
+ DB_FUNC_CLOSE => IGNORE,
+ DB_FUNC_DIRFREE => IGNORE,
+ DB_FUNC_DIRLIST => IGNORE,
+ DB_FUNC_EXISTS => IGNORE,
+ DB_FUNC_FREE => IGNORE,
+ DB_FUNC_FSYNC => IGNORE,
+ DB_FUNC_IOINFO => IGNORE,
+ DB_FUNC_MALLOC => IGNORE,
+ DB_FUNC_MAP => IGNORE,
+ DB_FUNC_OPEN => IGNORE,
+ DB_FUNC_READ => IGNORE,
+ DB_FUNC_REALLOC => IGNORE,
+ DB_FUNC_SEEK => IGNORE,
+ DB_FUNC_SLEEP => IGNORE,
+ DB_FUNC_STRDUP => IGNORE,
+ DB_FUNC_UNLINK => IGNORE,
+ DB_FUNC_UNMAP => IGNORE,
+ DB_FUNC_WRITE => IGNORE,
+ DB_FUNC_YIELD => IGNORE,
+
+ #########
+ # 2.3.14
+ #########
+
+ DB_TSL_SPINS => IGNORE,
+
+ #########
+ # 2.3.16
+ #########
+
+ DB_DBM_HSEARCH => IGNORE,
+ firstkey => IGNORE,
+ hdestroy => IGNORE,
+
+ #########
+ # 2.4.10
+ #########
+
+ DB_CURLSN => DEFINE,
+ DB_FUNC_RUNLINK => IGNORE,
+ DB_REGION_ANON => DEFINE,
+ DB_REGION_INIT => DEFINE,
+ DB_REGION_NAME => DEFINE,
+ DB_TXN_LOCK_OPTIMIST => DEFINE,
+ __CURRENTLY_UNUSED => IGNORE,
+
+ # enum db_status_t
+ DB_LSTAT_ABORTED => IGNORE, # 2.4.10
+ DB_LSTAT_ERR => IGNORE, # 2.4.10
+ DB_LSTAT_FREE => IGNORE, # 2.4.10
+ DB_LSTAT_HELD => IGNORE, # 2.4.10
+ DB_LSTAT_NOGRANT => IGNORE, # 2.4.10
+ DB_LSTAT_PENDING => IGNORE, # 2.4.10
+ DB_LSTAT_WAITING => IGNORE, # 2.4.10
+
+ #########
+ # 2.4.14
+ #########
+
+ DB_MUTEXLOCKS => DEFINE,
+ DB_PAGEYIELD => DEFINE,
+ __UNUSED_100 => IGNORE,
+ __UNUSED_4000 => IGNORE,
+
+ #########
+ # 2.5.2
+ #########
+
+ DBC_CONTINUE => IGNORE,
+ DBC_KEYSET => IGNORE,
+ DBC_RECOVER => IGNORE,
+ DBC_RMW => IGNORE,
+ DB_DBM_ERROR => IGNORE,
+ DB_GET_BOTH => DEFINE,
+ DB_NEXT_DUP => DEFINE,
+ DB_OPFLAGS_MASK => DEFINE,
+ DB_RMW => DEFINE,
+ DB_RUNRECOVERY => DEFINE,
+ dbmclose => IGNORE,
+
+ #########
+ # 2.5.9
+ #########
+
+ DB_DUPSORT => DEFINE,
+ DB_JOIN_ITEM => DEFINE,
+
+ #########
+ # 2.6.4
+ #########
+
+ DBC_WRITER => IGNORE,
+ DB_AM_CDB => IGNORE,
+ DB_ENV_CDB => DEFINE,
+ DB_INIT_CDB => DEFINE,
+ DB_LOCK_UPGRADE => DEFINE,
+ DB_WRITELOCK => DEFINE,
+
+ #########
+ # 2.7.1
+ #########
+
+
+ # enum db_lockop_t
+ DB_LOCK_INHERIT => '2.7.1',
+
+ #########
+ # 2.7.7
+ #########
+
+ DB_FCNTL_LOCKING => DEFINE,
+
+ #########
+ # 3.0.55
+ #########
+
+ DBC_WRITECURSOR => IGNORE,
+ DB_AM_DISCARD => IGNORE,
+ DB_AM_SUBDB => IGNORE,
+ DB_BT_REVSPLIT => IGNORE,
+ DB_CONSUME => DEFINE,
+ DB_CXX_NO_EXCEPTIONS => DEFINE,
+ DB_DBT_REALLOC => IGNORE,
+ DB_DUPCURSOR => DEFINE,
+ DB_ENV_CREATE => DEFINE,
+ DB_ENV_DBLOCAL => DEFINE,
+ DB_ENV_LOCKDOWN => DEFINE,
+ DB_ENV_LOCKING => DEFINE,
+ DB_ENV_LOGGING => DEFINE,
+ DB_ENV_NOMMAP => DEFINE,
+ DB_ENV_OPEN_CALLED => DEFINE,
+ DB_ENV_PRIVATE => DEFINE,
+ DB_ENV_SYSTEM_MEM => DEFINE,
+ DB_ENV_TXN => DEFINE,
+ DB_ENV_TXN_NOSYNC => DEFINE,
+ DB_ENV_USER_ALLOC => DEFINE,
+ DB_FORCE => DEFINE,
+ DB_LOCKDOWN => DEFINE,
+ DB_LOCK_RECORD => DEFINE,
+ DB_LOGFILEID_INVALID => DEFINE,
+ DB_MPOOL_NEW_GROUP => DEFINE,
+ DB_NEXT_NODUP => DEFINE,
+ DB_OK_BTREE => DEFINE,
+ DB_OK_HASH => DEFINE,
+ DB_OK_QUEUE => DEFINE,
+ DB_OK_RECNO => DEFINE,
+ DB_OLD_VERSION => DEFINE,
+ DB_OPEN_CALLED => DEFINE,
+ DB_PAGE_LOCK => DEFINE,
+ DB_POSITION => DEFINE,
+ DB_POSITIONI => DEFINE,
+ DB_PRIVATE => DEFINE,
+ DB_QAMMAGIC => DEFINE,
+ DB_QAMOLDVER => DEFINE,
+ DB_QAMVERSION => DEFINE,
+ DB_RECORD_LOCK => DEFINE,
+ DB_REVSPLITOFF => DEFINE,
+ DB_SYSTEM_MEM => DEFINE,
+ DB_TEST_POSTLOG => DEFINE,
+ DB_TEST_POSTLOGMETA => DEFINE,
+ DB_TEST_POSTOPEN => DEFINE,
+ DB_TEST_POSTRENAME => DEFINE,
+ DB_TEST_POSTSYNC => DEFINE,
+ DB_TEST_PREOPEN => DEFINE,
+ DB_TEST_PRERENAME => DEFINE,
+ DB_TXN_NOWAIT => DEFINE,
+ DB_TXN_SYNC => DEFINE,
+ DB_UPGRADE => DEFINE,
+ DB_VERB_CHKPOINT => DEFINE,
+ DB_VERB_DEADLOCK => DEFINE,
+ DB_VERB_RECOVERY => DEFINE,
+ DB_VERB_WAITSFOR => DEFINE,
+ DB_WRITECURSOR => DEFINE,
+ DB_XA_CREATE => DEFINE,
+
+ # enum DBTYPE
+ DB_QUEUE => '3.0.55',
+
+ #########
+ # 3.1.12
+ #########
+
+ DBC_ACTIVE => IGNORE,
+ DBC_OPD => IGNORE,
+ DBC_TRANSIENT => IGNORE,
+ DBC_WRITEDUP => IGNORE,
+ DB_AGGRESSIVE => DEFINE,
+ DB_AM_DUPSORT => IGNORE,
+ DB_CACHED_COUNTS => DEFINE,
+ DB_CLIENT => DEFINE,
+ DB_DBT_DUPOK => IGNORE,
+ DB_DBT_ISSET => IGNORE,
+ DB_ENV_RPCCLIENT => DEFINE,
+ DB_GET_BOTHC => DEFINE,
+ DB_JOIN_NOSORT => DEFINE,
+ DB_NODUPDATA => DEFINE,
+ DB_NOORDERCHK => DEFINE,
+ DB_NOSERVER => DEFINE,
+ DB_NOSERVER_HOME => DEFINE,
+ DB_NOSERVER_ID => DEFINE,
+ DB_ODDFILESIZE => DEFINE,
+ DB_ORDERCHKONLY => DEFINE,
+ DB_PREV_NODUP => DEFINE,
+ DB_PR_HEADERS => DEFINE,
+ DB_PR_PAGE => DEFINE,
+ DB_PR_RECOVERYTEST => DEFINE,
+ DB_RDWRMASTER => DEFINE,
+ DB_SALVAGE => DEFINE,
+ DB_VERIFY_BAD => DEFINE,
+ DB_VERIFY_FATAL => DEFINE,
+ DB_VRFY_FLAGMASK => DEFINE,
+
+ # enum db_recops
+ DB_TXN_ABORT => '3.1.12',
+ DB_TXN_BACKWARD_ROLL => '3.1.12',
+ DB_TXN_FORWARD_ROLL => '3.1.12',
+ DB_TXN_OPENFILES => '3.1.12',
+
+ #########
+ # 3.2.3
+ #########
+
+ DBC_COMPENSATE => IGNORE,
+ DB_AM_VERIFYING => IGNORE,
+ DB_CDB_ALLDB => DEFINE,
+ DB_ENV_CDB_ALLDB => DEFINE,
+ DB_EXTENT => DEFINE,
+ DB_JOINENV => DEFINE,
+ DB_LOCK_SWITCH => DEFINE,
+ DB_MPOOL_EXTENT => DEFINE,
+ DB_REGION_MAGIC => DEFINE,
+ DB_UNRESOLVED_CHILD => DEFINE,
+ DB_VERIFY => DEFINE,
+
+ # enum db_notices
+ DB_NOTICE_LOGFILE_CHANGED => IGNORE, # 3.2.3
+
+ #########
+ # 3.2.6
+ #########
+
+ DB_ALREADY_ABORTED => DEFINE,
+ DB_CONSUME_WAIT => DEFINE,
+ DB_JAVA_CALLBACK => DEFINE,
+ DB_TEST_POSTEXTDELETE => DEFINE,
+ DB_TEST_POSTEXTOPEN => DEFINE,
+ DB_TEST_POSTEXTUNLINK => DEFINE,
+ DB_TEST_PREEXTDELETE => DEFINE,
+ DB_TEST_PREEXTOPEN => DEFINE,
+ DB_TEST_PREEXTUNLINK => DEFINE,
+
+ # enum db_lockmode_t
+ DB_LOCK_WAIT => IGNORE, # 3.2.6
+
+ #########
+ # 3.3.4
+ #########
+
+ DBC_DIRTY_READ => IGNORE,
+ DBC_MULTIPLE => IGNORE,
+ DBC_MULTIPLE_KEY => IGNORE,
+ DB_AM_DIRTY => IGNORE,
+ DB_AM_SECONDARY => IGNORE,
+ DB_COMMIT => DEFINE,
+ DB_DBT_APPMALLOC => IGNORE,
+ DB_DIRTY_READ => DEFINE,
+ DB_DONOTINDEX => DEFINE,
+ DB_ENV_PANIC_OK => DEFINE,
+ DB_ENV_RPCCLIENT_GIVEN => DEFINE,
+ DB_FAST_STAT => DEFINE,
+ DB_LOCK_MAXLOCKS => DEFINE,
+ DB_LOCK_MINLOCKS => DEFINE,
+ DB_LOCK_MINWRITE => DEFINE,
+ DB_MULTIPLE => DEFINE,
+ DB_MULTIPLE_KEY => DEFINE,
+ DB_PAGE_NOTFOUND => DEFINE,
+ DB_RPC_SERVERPROG => DEFINE,
+ DB_RPC_SERVERVERS => DEFINE,
+ DB_UPDATE_SECONDARY => DEFINE,
+ DB_XIDDATASIZE => DEFINE,
+
+ # enum db_recops
+ DB_TXN_POPENFILES => '3.3.4',
+
+ # enum db_lockop_t
+ DB_LOCK_UPGRADE_WRITE => '3.3.4',
+
+ # enum db_lockmode_t
+ DB_LOCK_DIRTY => IGNORE, # 3.3.4
+ DB_LOCK_WWRITE => IGNORE, # 3.3.4
+
+ #########
+ # 3.3.11
+ #########
+
+ DB_SECONDARY_BAD => DEFINE,
+ DB_SURPRISE_KID => DEFINE,
+ DB_TEST_POSTDESTROY => DEFINE,
+ DB_TEST_PREDESTROY => DEFINE,
+
+ #########
+ # 4.0.7
+ #########
+
+ DB_APPLY_LOGREG => DEFINE,
+ DB_BROADCAST_EID => DEFINE,
+ DB_CL_WRITER => DEFINE,
+ DB_ENV_NOLOCKING => DEFINE,
+ DB_ENV_NOPANIC => DEFINE,
+ DB_ENV_REGION_INIT => DEFINE,
+ DB_ENV_REP_CLIENT => DEFINE,
+ DB_ENV_REP_LOGSONLY => DEFINE,
+ DB_ENV_REP_MASTER => DEFINE,
+ DB_ENV_YIELDCPU => DEFINE,
+ DB_GET_BOTH_RANGE => DEFINE,
+ DB_INVALID_EID => DEFINE,
+ DB_LOCK_EXPIRE => DEFINE,
+ DB_LOCK_FREE_LOCKER => DEFINE,
+ DB_LOCK_SET_TIMEOUT => DEFINE,
+ DB_LOGC_BUF_SIZE => DEFINE,
+ DB_LOG_DISK => DEFINE,
+ DB_LOG_LOCKED => DEFINE,
+ DB_LOG_SILENT_ERR => DEFINE,
+ DB_NOLOCKING => DEFINE,
+ DB_NOPANIC => DEFINE,
+ DB_PANIC_ENVIRONMENT => DEFINE,
+ DB_REP_CLIENT => DEFINE,
+ DB_REP_DUPMASTER => DEFINE,
+ DB_REP_HOLDELECTION => DEFINE,
+ DB_REP_LOGSONLY => DEFINE,
+ DB_REP_MASTER => DEFINE,
+ DB_REP_NEWMASTER => DEFINE,
+ DB_REP_NEWSITE => DEFINE,
+ DB_REP_OUTDATED => DEFINE,
+ DB_REP_PERMANENT => DEFINE,
+ DB_REP_UNAVAIL => DEFINE,
+ DB_SET_LOCK_TIMEOUT => DEFINE,
+ DB_SET_TXN_NOW => DEFINE,
+ DB_SET_TXN_TIMEOUT => DEFINE,
+ DB_STAT_CLEAR => DEFINE,
+ DB_TIMEOUT => DEFINE,
+ DB_YIELDCPU => DEFINE,
+ MP_FLUSH => IGNORE,
+ MP_OPEN_CALLED => IGNORE,
+ MP_READONLY => IGNORE,
+ MP_UPGRADE => IGNORE,
+ MP_UPGRADE_FAIL => IGNORE,
+ TXN_CHILDCOMMIT => IGNORE,
+ TXN_COMPENSATE => IGNORE,
+ TXN_DIRTY_READ => IGNORE,
+ TXN_LOCKTIMEOUT => IGNORE,
+ TXN_MALLOC => IGNORE,
+ TXN_NOSYNC => IGNORE,
+ TXN_NOWAIT => IGNORE,
+ TXN_SYNC => IGNORE,
+
+ # enum db_recops
+ DB_TXN_APPLY => '4.0.7',
+
+ # enum db_lockop_t
+ DB_LOCK_GET_TIMEOUT => '4.0.7',
+ DB_LOCK_PUT_READ => '4.0.7',
+ DB_LOCK_TIMEOUT => '4.0.7',
+
+ # enum db_status_t
+ DB_LSTAT_EXPIRED => IGNORE, # 4.0.7
+
) ;
+sub enum_Macro
+{
+ my $str = shift ;
+ my ($major, $minor, $patch) = split /\./, $str ;
+
+ my $macro =
+ "#if (DB_VERSION_MAJOR > $major) || \\\n" .
+ " (DB_VERSION_MAJOR == $major && DB_VERSION_MINOR > $minor) || \\\n" .
+ " (DB_VERSION_MAJOR == $major && DB_VERSION_MINOR == $minor && \\\n" .
+ " DB_VERSION_PATCH >= $patch)\n" ;
+
+ return $macro;
+
+}
+
sub OutputXS
{
- # skip to the marker
- if (0) {
- while (<>)
- {
- last if /^MARKER/ ;
- print ;
- }
- }
-
+
+ my @names = () ;
+
foreach my $key (sort keys %constants)
{
- my $isEnum = $constants{$key} ;
-
- if ($isEnum) {
- print <<EOM
- if (strEQ(name, "$key"))
- return $key;
-EOM
- }
- else
- {
- print <<EOM
- if (strEQ(name, "$key"))
-#ifdef $key
- return $key;
-#else
- goto not_there;
-#endif
-EOM
- }
-
- }
-
- if (0) {
- while (<>)
- {
- print ;
- }
+ my $val = $constants{$key} ;
+ next if $val eq IGNORE;
+
+ if ($val eq STRING)
+ { push @names, { name => $key, type => "PV" } }
+ elsif ($val eq DEFINE)
+ { push @names, $key }
+ else
+ { push @names, { name => $key, macro => [enum_Macro($val), "#endif\n"] } }
}
+
+ WriteConstants(
+ NAME => BerkeleyDB,
+ NAMES => \@names,
+ C_FILE => 'constants.h',
+ XS_FILE => 'constants.xs',
+ ) ;
}
sub OutputPM
{
- # skip to the marker
- if (0) {
- while (<>)
+ my $START = '@EXPORT = qw(' ;
+ my $START_re = quotemeta $START ;
+ my $END = ');';
+ my $END_re = quotemeta $END ;
+
+ # skip to the @EXPORT declaration
+ OUTER: while (<>)
+ {
+ if ( /^\s*$START_re/ )
{
- last if /^MARKER/ ;
- print ;
+ # skip to the end marker.
+ while (<>)
+ { last OUTER if /^\s*$END_re/ }
}
+ print ;
}
+ print "$START\n";
foreach my $key (sort keys %constants)
{
+ next if $constants{$key} eq IGNORE;
print "\t$key\n";
}
+ print "\t$END\n";
- if (0) {
- while (<>)
- {
- print ;
- }
+ while (<>)
+ {
+ print ;
}
}
-OutputXS() if $ARGV[0] =~ /xs/i ;
-OutputPM() if $ARGV[0] =~ /pm/i ;
+my $opt = shift ;
+OutputXS() if $opt =~ /^xs/i ;
+OutputPM() if $opt =~ /^pm/i ;