diff options
-rw-r--r-- | source3/lib/dbwrap/dbwrap_rbt.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_rbt.c b/source3/lib/dbwrap/dbwrap_rbt.c index 54d3fa3aae..3b5574a257 100644 --- a/source3/lib/dbwrap/dbwrap_rbt.c +++ b/source3/lib/dbwrap/dbwrap_rbt.c @@ -316,6 +316,20 @@ static int db_rbt_exists(struct db_context *db, TDB_DATA key) return db_rbt_search_internal(db, key, NULL); } +static int db_rbt_parse_record(struct db_context *db, TDB_DATA key, + int (*parser)(TDB_DATA key, TDB_DATA data, + void *private_data), + void *private_data) +{ + struct db_rbt_search_result res; + bool found = db_rbt_search_internal(db, key, &res); + + if (!found) { + return -1; + } + return parser(res.key, res.val, private_data); +} + static int db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data) { @@ -419,6 +433,7 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx) result->transaction_commit = db_rbt_trans_dummy; result->transaction_cancel = db_rbt_trans_dummy; result->exists = db_rbt_exists; + result->parse_record = db_rbt_parse_record; return result; } |