Add support for Sleepycat Berkeley DB 3.1 (ITS#649)

changes derived from Ian Logan's patch
This commit is contained in:
Kurt Zeilenga 2000-08-07 19:46:37 +00:00
parent 6be4f4fdb2
commit 063691aec0
2 changed files with 19 additions and 5 deletions

View File

@ -317,14 +317,17 @@ main()
int rc;
u_int32_t flags = DB_CREATE | DB_THREAD;
#if DB_VERSION_MAJOR > 2
DB_ENV *env = NULL;
rc = db_env_create( &env, 0 );
if( rc == 0 ) {
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
rc = env->open( env, NULL, flags, 0 );
#else
rc = env->open( env, NULL, NULL, flags, 0 );
#endif
}
#else
@ -336,6 +339,13 @@ main()
if( rc == 0 ) {
db_appexit( &env );
}
#endif
#if DB_VERSION_MAJOR > 2
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
env->remove( env, NULL, DB_FORCE);
#else
env->remove( env, NULL, NULL, DB_FORCE);
#endif
#endif
return rc;

View File

@ -145,12 +145,17 @@ int ldbm_initialize( void )
return( 1 );
}
#if DB_VERSION_MAJOR >= 3
#if DB_VERSION_MAJOR > 2
ldbm_Env->set_errcall( ldbm_Env, ldbm_db_errcall );
ldbm_Env->set_errpfx( ldbm_Env, "==>" );
envFlags |= DB_INIT_MPOOL;
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
err = ldbm_Env->open( ldbm_Env, NULL, envFlags, 0 );
#else
err = ldbm_Env->open( ldbm_Env, NULL, NULL, envFlags, 0 );
#endif
if ( err != 0 )
{
char error[BUFSIZ];
@ -175,7 +180,7 @@ int ldbm_shutdown( void )
if( !ldbm_initialized ) return 1;
#if DB_VERSION_MAJOR >= 3
ldbm_Env->close( ldbm_Env, 0 );
ldbm_Env->close( ldbm_Env, 0 );
#else
db_appexit( ldbm_Env );
#endif
@ -253,8 +258,7 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize )
memset( &dbinfo, '\0', sizeof( dbinfo ));
#if defined( DB_VERSION_MAJOR ) && defined( DB_VERSION_MINOR ) && \
DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 4
#if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 4
/*
* BerkeleyDB 2.4 do not allow db_cachesize
* to be specified if an DB_ENV is.