+ rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
+ if ( rc ) return rc;
+
+ /* Get the nattrs / nvals counts first */
+ data.ulen = data.dlen = sizeof(buf);
+ data.data = buf;
+ rc = cursor->c_get( cursor, &key, &data, DB_SET );
+ if ( rc ) goto finish;
+
+
+ eh.bv.bv_val = buf;
+ eh.bv.bv_len = data.size;
+ rc = entry_header( &eh );
+ if ( rc ) goto finish;
+
+ if ( eh.nvals ) {
+ /* Get the size */
+ data.flags ^= DB_DBT_PARTIAL;
+ data.ulen = 0;
+ rc = cursor->c_get( cursor, &key, &data, DB_CURRENT );
+ if ( rc != DB_BUFFER_SMALL ) goto finish;
+
+ /* Allocate a block and retrieve the data */
+ off = eh.data - eh.bv.bv_val;
+ eh.bv.bv_len = eh.nvals * sizeof( struct berval ) + data.size;
+ eh.bv.bv_val = ch_malloc( eh.bv.bv_len );
+ eh.data = eh.bv.bv_val + eh.nvals * sizeof( struct berval );
+ data.data = eh.data;
+ data.ulen = data.size;
+
+ /* skip past already parsed nattr/nvals */
+ eh.data += off;
+
+ rc = cursor->c_get( cursor, &key, &data, DB_CURRENT );
+ }
+
+finish:
+ cursor->c_close( cursor );