|
@@ -741,10 +741,6 @@ mdbiter_next_key (MDBIterator *it)
|
|
* it->rc is set to the result of the next iteration.
|
|
* it->rc is set to the result of the next iteration.
|
|
*/
|
|
*/
|
|
it->iter_op_fn (it);
|
|
it->iter_op_fn (it);
|
|
- LOG_TRACE(
|
|
|
|
- "Found spok: {%lx, %lx, %lx}",
|
|
|
|
- it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
-
|
|
|
|
MDB_val key, data;
|
|
MDB_val key, data;
|
|
int db_rc;
|
|
int db_rc;
|
|
|
|
|
|
@@ -753,25 +749,29 @@ mdbiter_next_key (MDBIterator *it)
|
|
data.mv_size = KLEN;
|
|
data.mv_size = KLEN;
|
|
|
|
|
|
if (it->luc) {
|
|
if (it->luc) {
|
|
- rc = LSUP_NORESULT; // Intermediary value, will never be returned.
|
|
|
|
-
|
|
|
|
- while (rc == LSUP_NORESULT) {
|
|
|
|
|
|
+ rc = LSUP_NORESULT; // Flow control value, will never be returned.
|
|
|
|
+ do {
|
|
//LOG_DEBUG("begin ctx loop.");
|
|
//LOG_DEBUG("begin ctx loop.");
|
|
- // If ctx is specified, look if the matching triple is associated
|
|
|
|
- // with it. If not, move on to the next triple.
|
|
|
|
- // The loop normally exits when a triple with matching ctx is found
|
|
|
|
- // (LSUP_OK), if there are no more triples (LSUP_END), or if there
|
|
|
|
- // is an error (LSUP_DB_ERR).
|
|
|
|
|
|
+ /* If ctx is specified, look if the matching triple is associated
|
|
|
|
+ * with it. If not, move on to the next triple.
|
|
|
|
+ * The loop normally exits when a triple with matching ctx is found
|
|
|
|
+ * (LSUP_OK), if there are no more triples (LSUP_END), or if there
|
|
|
|
+ * is an error (LSUP_DB_ERR).
|
|
|
|
+ */
|
|
|
|
+ LOG_TRACE (
|
|
|
|
+ "Found spok: {%lx, %lx, %lx}",
|
|
|
|
+ it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
+
|
|
key.mv_data = it->spok;
|
|
key.mv_data = it->spok;
|
|
|
|
|
|
db_rc = mdb_cursor_get (it->ctx_cur, &key, &data, MDB_GET_BOTH);
|
|
db_rc = mdb_cursor_get (it->ctx_cur, &key, &data, MDB_GET_BOTH);
|
|
|
|
|
|
if (db_rc == MDB_SUCCESS) {
|
|
if (db_rc == MDB_SUCCESS) {
|
|
rc = LSUP_OK;
|
|
rc = LSUP_OK;
|
|
- LOG_TRACE("Triple found for context.");
|
|
|
|
|
|
+ LOG_TRACE("Triple found in context: %x", it->luc);
|
|
|
|
|
|
} else if (db_rc == MDB_NOTFOUND) {
|
|
} else if (db_rc == MDB_NOTFOUND) {
|
|
- LOG_TRACE("No triples found for context: %x", it->luc);
|
|
|
|
|
|
+ LOG_TRACE("Triple not found in context: %x", it->luc);
|
|
if (it->rc == MDB_NOTFOUND) rc = LSUP_END;
|
|
if (it->rc == MDB_NOTFOUND) rc = LSUP_END;
|
|
else it->iter_op_fn (it);
|
|
else it->iter_op_fn (it);
|
|
|
|
|
|
@@ -779,10 +779,15 @@ mdbiter_next_key (MDBIterator *it)
|
|
log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
rc = LSUP_DB_ERR;
|
|
rc = LSUP_DB_ERR;
|
|
}
|
|
}
|
|
|
|
+ } while (rc == LSUP_NORESULT);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
+ LOG_TRACE (
|
|
|
|
+ "Found spok in any context: {%lx, %lx, %lx}",
|
|
|
|
+ it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
|
|
- } else rc = LSUP_OK;
|
|
|
|
|
|
+ rc = LSUP_OK;
|
|
|
|
+ }
|
|
|
|
|
|
// Get all contexts for a triple.
|
|
// Get all contexts for a triple.
|
|
key.mv_data = it->spok;
|
|
key.mv_data = it->spok;
|