}
-// Prepare for a sequential search of an entire database.
-// (There is guaranteed to be no more than one traversal in
-// progress per thread at any given time.)
-void bdb_rewind(int cdb) {
+// Prepare for a sequential search of an entire database. Returns a cursor.
+void *bdb_rewind(int cdb) {
int ret = 0;
if (TSD->cursors[cdb] != NULL) {
syslog(LOG_ERR, "bdb: bdb_rewind: must close cursor on database %d before reopening", cdb);
bdb_abort();
- // bdb_cclose(TSD->cursors[cdb]);
}
// Now initialize the cursor
syslog(LOG_ERR, "bdb: bdb_rewind: db_cursor: %s", db_strerror(ret));
bdb_abort();
}
+
+ syslog(LOG_DEBUG, "\033[33m--- begin cursor %x ---\033[0m", cdb);
+ return((void *)TSD->cursors[cdb]);
}
// Fetch the next item in a sequential search. Returns a pointer to a
// cdbdata structure, or NULL if we've hit the end.
-struct cdbdata *bdb_next_item(int cdb) {
+struct cdbdata *bdb_next_item(void *cursor, int cdb) {
DBT key, data;
struct cdbdata *cdbret;
int ret = 0;
bdb_abort();
}
bdb_close_cursor(cdb);
+ syslog(LOG_DEBUG, "\033[33m--- end cursor %x ---\033[0m", cdb);
return NULL; // presumably, end of file
}