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
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;
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];
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
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.