# standard unix ndbm
# Fallback settings, defaults are set in build/*/Make-platform
+# The NDBM interface may not work on some (any) platforms.
+# You may be happier with Berkeley DB B-trees.
LDBMBACKEND?=-DLDBM_USE_NDBM
LDBMINCLUDE?=
LDBMLIB?=
#LDBMINCLUDE=-I/usr/local/gdbm/include
#LDBMLIB=-lgdbm
-#undef these if you have SLEEPYCAT DB2 installed
-#LDBMBACKEND=-DLDBM_USE_DBBTREE -DHAVE_SLEEPYCAT_DB2
+#undef these if you have SleepyCat DB2 installed the updated DBI
+#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2
+#LDBMINCLUDE=-I/usr/local/include
+#LDBMLIB=-L/usr/local/lib -ldb
+
+#undef these if you have SleepyCat DB2 installed (with compat185)
+#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2_COMPAT185
#LDBMINCLUDE=-I/usr/local/include
#LDBMLIB=-L/usr/local/lib -ldb
#include <limits.h>
#include <fcntl.h>
-#ifdef HAVE_SLEEPYCAT_DB2
+#ifdef LDBM_USE_DB2_COMPAT185
# include <db_185.h>
#else
# include <db.h>
+# ifdef LDBM_USE_DB2
+# define R_NOOVERWRITE DB_NOOVERWRITE
+# define DEFAULT_DB_PAGE_SIZE 1024
+# endif
#endif
typedef DBT Datum;
#define DB_TYPE DB_HASH
/* for ldbm_open */
-#define LDBM_READER O_RDONLY
-#define LDBM_WRITER O_RDWR
-#define LDBM_WRCREAT (O_RDWR|O_CREAT)
-#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
-#define LDBM_FAST 0
+#ifdef LDBM_USE_DB2
+# define LDBM_READER DB_RDONLY
+# define LDBM_WRITER 0x00000 /* hopefully */
+# define LDBM_WRCREAT (DB_NOMMAP|DB_CREATE|DB_THREAD)
+# define LDBM_NEWDB (DB_TRUNCATE|DB_CREATE|DB_THREAD)
+#else
+# define LDBM_READER O_RDONLY
+# define LDBM_WRITER O_RDWR
+# define LDBM_WRCREAT (O_RDWR|O_CREAT)
+# define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
+# define LDBM_FAST 0
+#endif
#define LDBM_SUFFIX ".dbh"
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
-#ifdef HAVE_SLEEPYCAT_DB2
+
+#ifdef LDBM_USE_DB2_COMPAT185
# include <db_185.h>
#else
# include <db.h>
+# ifdef LDBM_USE_DB2
+# define R_NOOVERWRITE DB_NOOVERWRITE
+# define DEFAULT_DB_PAGE_SIZE 1024
+# endif
#endif
+
typedef DBT Datum;
#define dsize size
#define dptr data
#define DB_TYPE DB_BTREE
/* for ldbm_open */
-#define LDBM_READER O_RDONLY
-#define LDBM_WRITER O_RDWR
-#define LDBM_WRCREAT (O_RDWR|O_CREAT)
-#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
-#define LDBM_FAST 0
+#ifdef LDBM_USE_DB2
+# define LDBM_READER DB_RDONLY
+# define LDBM_WRITER 0x00000 /* hopefully */
+# define LDBM_WRCREAT (DB_NOMMAP|DB_CREATE|DB_THREAD)
+# define LDBM_NEWDB (DB_TRUNCATE|DB_CREATE|DB_THREAD)
+#else
+# define LDBM_READER O_RDONLY
+# define LDBM_WRITER O_RDWR
+# define LDBM_WRCREAT (O_RDWR|O_CREAT)
+# define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
+#endif
+
+# define LDBM_FAST 0
#define LDBM_SUFFIX ".dbb"
#define LDBM_ORDERED 1
#endif /* db btree */
#endif /* gdbm */
+int ldbm_errno( LDBM ldbm );
LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize );
void ldbm_close( LDBM ldbm );
void ldbm_sync( LDBM ldbm );
Datum ldbm_fetch( LDBM ldbm, Datum key );
int ldbm_store( LDBM ldbm, Datum key, Datum data, int flags );
int ldbm_delete( LDBM ldbm, Datum key );
-Datum ldbm_firstkey( LDBM ldbm );
-Datum ldbm_nextkey( LDBM ldbm, Datum key );
-int ldbm_errno( LDBM ldbm );
+
+#if LDBM_USE_DB2
+ void *ldbm_malloc( size_t size );
+ Datum ldbm_firstkey( LDBM ldbm, DBC **dbch );
+ Datum ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp );
+#else
+ Datum ldbm_firstkey( LDBM ldbm );
+ Datum ldbm_nextkey( LDBM ldbm, Datum key );
+#endif
#endif /* _ldbm_h_ */
/* ldbm.c - ldap dbm compatibility routines */
+/* Patched for Berkeley DB version 2.0; /KSp; 98/02/23
+ *
+ * - basic implementation; 1998/02/23, /KSp
+ * - DB_DBT_MALLOC ; 1998/03/22, /KSp
+ */
+
#include <stdio.h>
#include "ldbm.h"
* *
*****************************************************************/
+#ifdef LDBM_USE_DB2
+/*************************************************
+ * *
+ * A malloc routine for use with DB_DBT_MALLOC *
+ * *
+ *************************************************/
+
+#include <stdlib.h>
+
+
+void *
+ldbm_malloc( size_t size )
+{
+ return( calloc( 1, size ));
+}
+
+#endif
+
+
LDBM
ldbm_open( char *name, int rw, int mode, int dbcachesize )
{
- LDBM ret;
+ LDBM ret = NULL;
+
+#ifdef LDBM_USE_DB2
+ DB_INFO dbinfo;
+
+ memset( &dbinfo, 0, sizeof( dbinfo ));
+ dbinfo.db_cachesize = dbcachesize;
+ dbinfo.db_pagesize = DEFAULT_DB_PAGE_SIZE;
+ dbinfo.db_malloc = ldbm_malloc;
+
+ db_open( name, DB_TYPE, rw, mode, NULL, &dbinfo, &ret );
+
+#else
void *info;
BTREEINFO binfo;
HASHINFO hinfo;
} else {
info = NULL;
}
+
ret = dbopen( name, rw, mode, DB_TYPE, info );
+
+#endif
+
return( ret );
}
void
ldbm_close( LDBM ldbm )
{
+#ifdef LDBM_USE_DB2
+ (*ldbm->close)( ldbm, 0 );
+#else
(*ldbm->close)( ldbm );
+#endif
}
void
{
Datum dup;
+#ifdef LDBM_USE_DB2
+ memset( &dup, 0, sizeof( dup ));
+#endif
+
if ( data.dsize == 0 ) {
dup.dsize = 0;
dup.dptr = NULL;
Datum data;
int rc;
+#ifdef LDBM_USE_DB2
+ memset( &data, 0, sizeof( data ));
+
+ data.flags = DB_DBT_MALLOC;
+
+ if ( (rc = (*ldbm->get)( ldbm, NULL, &key, &data, 0 )) != 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
if ( (rc = (*ldbm->get)( ldbm, &key, &data, 0 )) == 0 ) {
data = ldbm_datum_dup( ldbm, data );
} else {
+#endif
data.dptr = NULL;
data.dsize = 0;
}
{
int rc;
+#ifdef LDBM_USE_DB2
+ rc = (*ldbm->put)( ldbm, NULL, &key, &data, flags & ~LDBM_SYNC );
+ rc = (-1 ) * rc;
+#else
rc = (*ldbm->put)( ldbm, &key, &data, flags & ~LDBM_SYNC );
+#endif
if ( flags & LDBM_SYNC )
(*ldbm->sync)( ldbm, 0 );
return( rc );
{
int rc;
+#ifdef LDBM_USE_DB2
+ rc = (*ldbm->del)( ldbm, NULL, &key, 0 );
+ rc = (-1 ) * rc;
+#else
rc = (*ldbm->del)( ldbm, &key, 0 );
+#endif
(*ldbm->sync)( ldbm, 0 );
return( rc );
}
Datum
+#ifdef LDBM_USE_DB2
+ldbm_firstkey( LDBM ldbm, DBC **dbch )
+#else
ldbm_firstkey( LDBM ldbm )
+#endif
{
Datum key, data;
int rc;
+#ifdef LDBM_USE_DB2
+ DBC *dbci;
+
+ memset( &key, 0, sizeof( key ));
+ memset( &data, 0, sizeof( data ));
+
+ key.flags = data.flags = DB_DBT_MALLOC;
+
+ /* acquire a cursor for the DB */
+ if ( (*ldbm->cursor)( ldbm, NULL, &dbci )) {
+ return( key );
+ } else {
+ *dbch = dbci;
+ if ( (*dbci->c_get)( dbci, &key, &data, DB_NEXT ) == 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_FIRST )) == 0 ) {
key = ldbm_datum_dup( ldbm, key );
+#endif
} else {
key.dptr = NULL;
key.dsize = 0;
}
+
+#ifdef LDBM_USE_DB2
+ }
+#endif
+
return( key );
}
Datum
+#ifdef LDBM_USE_DB2
+ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp )
+#else
ldbm_nextkey( LDBM ldbm, Datum key )
+#endif
{
Datum data;
int rc;
+#ifdef LDBM_USE_DB2
+ void *oldKey = key.dptr;
+
+ memset( &data, 0, sizeof( data ));
+
+ data.flags = DB_DBT_MALLOC;
+
+ if ( (*dbcp->c_get)( dbcp, &key, &data, DB_NEXT ) == 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_NEXT )) == 0 ) {
key = ldbm_datum_dup( ldbm, key );
+#endif
} else {
key.dptr = NULL;
key.dsize = 0;
}
+#ifdef LDBM_USE_DB2
+ if ( oldKey ) free( oldKey );
+#endif
+
return( key );
}
#include "ldbm.h"
#define DEFAULT_CACHE_SIZE 1000
-#define DEFAULT_DBCACHE_SIZE 100000
+
+#ifdef LDBM_USE_DB2
+# define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
+#else
+# define DEFAULT_DBCACHE_SIZE 100000
+#endif
+
#define DEFAULT_DB_DIRECTORY "/usr/tmp"
#define DEFAULT_MODE 0600
)
{
Datum data;
+#ifdef LDBM_USE_DB2
+ memset( &data, 0, sizeof( data ) );
+#endif
pthread_mutex_lock( &db->dbc_mutex );
#ifdef reentrant_database
}
#endif
+#ifdef LDBM_DEBUG
+ Statslog( LDAP_DEBUG_STATS,
+ "=> ldbm_cache_store(): key.dptr=%s, key.dsize=%d\n",
+ key.dptr, key.dsize, 0, 0, 0 );
+
+ Statslog( LDAP_DEBUG_STATS,
+ "=> ldbm_cache_store(): key.dptr=0x%08x, data.dptr=0x%0 8x\n",
+ key.dptr, data.dptr, 0, 0, 0 );
+
+ Statslog( LDAP_DEBUG_STATS,
+ "=> ldbm_cache_store(): data.dptr=%s, data.dsize=%d\n",
+ data.dptr, data.dsize, 0, 0, 0 );
+
+ Statslog( LDAP_DEBUG_STATS,
+ "=> ldbm_cache_store(): flags=0x%08x\n",
+ flags, 0, 0, 0, 0 );
+#endif /* LDBM_DEBUG */
+
rc = ldbm_store( db->dbc_db, key, data, flags );
pthread_mutex_unlock( &db->dbc_mutex );
Datum key, data;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn, id, 0 );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
ID id;
Datum key, data;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
dn = strdup( dn );
dn_normalize_case( dn );
Datum key;
int rc;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\" )\n", dn, 0, 0 );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
IDList *idl;
char buf[20];
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %d, %d )\n", p ? p->e_id
: 0, e->e_id, 0 );
IDList *idl;
char buf[20];
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> has_children( %d )\n", p->e_id , 0, 0 );
if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
Datum key, data;
int len, rc, flags;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> id2entry_add( %d, \"%s\" )\n", e->e_id,
e->e_dn, 0 );
Datum key;
int rc;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> id2entry_delete( %d, \"%s\" )\n", e->e_id,
e->e_dn, 0 );
Datum key, data;
Entry *e;
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
Debug( LDAP_DEBUG_TRACE, "=> id2entry( %ld )\n", id, 0, 0 );
if ( (e = cache_find_entry_id( &li->li_cache, id )) != NULL ) {
char *kstr;
int i, nids;
+#ifdef LDBM_USE_DB2
+ memset( &k2, 0, sizeof( k2 ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
/* Debug( LDAP_DEBUG_TRACE, "=> idl_fetch_one\n", 0, 0, 0 ); */
data = ldbm_cache_fetch( db, key );
char *kstr;
int i, nids;
+#ifdef LDBM_USE_DB2
+ memset( &k2, 0, sizeof( k2 ) );
+ memset( &data, 0, sizeof( data ) );
+#endif
+
/* Debug( LDAP_DEBUG_TRACE, "=> idl_fetch\n", 0, 0, 0 ); */
data = ldbm_cache_fetch( db, key );
Datum data;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+#ifdef LDBM_USE_DB2
+ memset( &data, 0, sizeof( data ) );
+#endif
+
/* Debug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
data.dptr = (char *) idl;
data.dsize = (2 + idl->b_nmax) * sizeof(ID);
+#ifdef LDBM_DEBUG
+ Statslog( LDAP_DEBUG_STATS, "<= idl_store(): rc=%d\n",
+ rc, 0, 0, 0, 0 );
+#endif
+
flags = LDBM_REPLACE;
if( li->li_flush_wrt ) flags |= LDBM_SYNC;
rc = ldbm_cache_store( db, key, data, flags );
char *kstr;
Datum k2;
+#ifdef LDBM_USE_DB2
+ memset( &k2, 0, sizeof( k2 ) );
+#endif
+
if ( (idl = idl_fetch_one( be, db, key )) == NULL ) {
+#ifdef LDBM_DEBUG
+ Statslog( LDAP_DEBUG_STATS, "=> idl_insert_key(): no key yet\n",
+ 0, 0, 0, 0, 0 );
+#endif
+
idl = idl_alloc( 1 );
idl->b_ids[idl->b_nids++] = id;
rc = idl_store( be, db, key, idl );
char *realval, *tmpval;
char buf[BUFSIZ];
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+#endif
+
prefix = index2prefix( indextype );
Debug( LDAP_DEBUG_TRACE, "=> index_read( \"%s\" \"%c\" \"%s\" )\n",
type, prefix, val );
char *realval, *tmpval, *s;
char buf[BUFSIZ];
+#ifdef LDBM_USE_DB2
+ memset( &key, 0, sizeof( key ) );
+#endif
+
prefix = index2prefix( indextype );
Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
int amax, acur, dmax, dcur;
char **vals;
+#ifdef LDBM_USE_DB2
+ DBC *ocursorp;
+ DBC *ncursorp;
+#endif /* LDBM_USE_DB2 */
+
if ( verbose ) {
printf( "Generating mods for differential %s centroid...", attr );
fflush( stdout );
olast.dptr = NULL;
nlast.dptr = NULL;
+#ifdef LDBM_USE_DB2
+ for ( okey = ldbm_firstkey( oldbm, &ocursorp ),
+ nkey = ldbm_firstkey( nldbm, &ncursorp );
+ okey.dptr != NULL && nkey.dptr != NULL; )
+#else
for ( okey = ldbm_firstkey( oldbm ), nkey = ldbm_firstkey( nldbm );
okey.dptr != NULL && nkey.dptr != NULL; )
+#endif
{
rc = strcmp( okey.dptr, nkey.dptr );
}
nlast = nkey;
+#ifdef LDBM_USE_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
} else if ( rc > 0 ) {
/* new value is not in old centroid - add it */
if ( charray_add_dup( &avals, &acur, &amax, nkey.dptr ) == NULL ) {
ldbm_datum_free( nldbm, nlast );
}
nlast = nkey;
+
+#ifdef LDBM_USE_DB2
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
} else {
/* old value is not in new centroid - delete it */
if ( charray_add_dup( &dvals, &dcur, &dmax, okey.dptr ) == NULL ) {
ldbm_datum_free( oldbm, olast );
}
olast = okey;
+
+#ifdef LDBM_USE_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
+#endif
}
}
return( NULL );
}
+#ifdef LDBM_USE_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
+#endif
if ( olast.dptr != NULL ) {
ldbm_datum_free( oldbm, olast );
}
return( NULL );
}
+#ifdef LDBM_USE_DB2
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
if ( nlast.dptr != NULL ) {
ldbm_datum_free( nldbm, nlast );
}
/* generate list of values to add */
lastkey.dptr = NULL;
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( nldbm, &ncursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( nldbm, lastkey, ncursorp ) )
+#else
for ( key = ldbm_firstkey( nldbm ); key.dptr != NULL;
- key = ldbm_nextkey( nldbm, lastkey ) ) {
+ key = ldbm_nextkey( nldbm, lastkey ) )
+#endif
+ {
/* see if it's in the old one */
data = ldbm_fetch( oldbm, key );
/* generate list of values to delete */
lastkey.dptr = NULL;
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( oldbm, &ocursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( oldbm, lastkey, ocursorp ) )
+#else
for ( key = ldbm_firstkey( oldbm ); key.dptr != NULL;
- key = ldbm_nextkey( oldbm, lastkey ) ) {
+ key = ldbm_nextkey( oldbm, lastkey ) )
+#endif
+ {
/* see if it's in the new one */
data = ldbm_fetch( nldbm, key );
char **vals;
int vcur, vmax;
+#ifdef LDBM_USE_DB2
+ DBC *cursorp;
+#endif
+
if ( verbose ) {
printf( "Generating mods for full %s centroid...", attr );
fflush( stdout );
lastkey.dptr = NULL;
vals = NULL;
vcur = vmax = 0;
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( ldbm, &cursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( ldbm, lastkey, cursorp ) )
+#else
for ( key = ldbm_firstkey( ldbm ); key.dptr != NULL;
- key = ldbm_nextkey( ldbm, lastkey ) ) {
+ key = ldbm_nextkey( ldbm, lastkey ) )
+#endif
+ {
if ( charray_add_dup( &vals, &vcur, &vmax, key.dptr ) == NULL ) {
ldap_mods_free( mods, 1 );
return( NULL );
char *file, *s;
int printid = 1;
+#ifdef LDBM_USE_DB2
+ DBC *cursorp;
+#endif
+
if ( argc < 2 || argc > 3 || ( argc == 3 && strcmp( argv[1], "-n" )
!= 0 )) {
usage( argv[0] );
}
last.dptr = NULL;
+
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( dbp, &cursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( dbp, last, cursorp ) )
+#else
for ( key = ldbm_firstkey( dbp ); key.dptr != NULL;
- key = ldbm_nextkey( dbp, last ) ) {
+ key = ldbm_nextkey( dbp, last ) )
+#endif
+ {
if ( last.dptr != NULL )
ldbm_datum_free( dbp, last );
data = ldbm_fetch( dbp, key );
int i;
extern char *optarg;
+#ifdef LDBM_USE_DB2
+ DBC *cursorp;
+#endif
+
tailorfile = SLAPD_DEFAULT_CONFIGFILE;
while ( (i = getopt( argc, argv, "d:f:" )) != EOF ) {
switch ( i ) {
}
savekey.dptr = NULL;
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( dbc->dbc_db, &cursorp );
+ key.dptr != NULL;
+ key = ldbm_nextkey( dbc->dbc_db, key, cursorp ) )
+#else
for ( key = ldbm_firstkey( dbc->dbc_db );
key.dptr != NULL;
- key = ldbm_nextkey( dbc->dbc_db, key ) ) {
+ key = ldbm_nextkey( dbc->dbc_db, key ) )
+#endif
+ {
if ( savekey.dptr != NULL )
ldbm_datum_free( dbc->dbc_db, savekey );
savekey = key;
}
last.dptr = NULL;
+
+#ifdef LDBM_USE_DB2
+ for ( key = ldbm_firstkey( dbp, &cursorp );
+ key.dptr != NULL;
+ key = ldbm_nextkey( dbp, last, cursorp ) )
+#else
for ( key = ldbm_firstkey( dbp ); key.dptr != NULL;
- key = ldbm_nextkey( dbp, last ) ) {
+ key = ldbm_nextkey( dbp, last ) )
+#endif
+ {
if ( last.dptr != NULL ) {
ldbm_datum_free( dbp, last );
}