s3:dbwrap: add specific dbwrap_exists() implementation to dbwrap_tdb
authorGregor Beck <gbeck@sernet.de>
Mon, 4 Jul 2011 08:27:17 +0000 (10:27 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 11 Oct 2011 12:17:55 +0000 (14:17 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/lib/dbwrap/dbwrap_tdb.c

index 63d2729..8964510 100644 (file)
@@ -181,6 +181,13 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        return 0;
 }
 
+static int db_tdb_exists(struct db_context *db, TDB_DATA key)
+{
+       struct db_tdb_ctx *ctx = talloc_get_type_abort(
+               db->private_data, struct db_tdb_ctx);
+       return tdb_exists(ctx->wtdb->tdb, key);
+}
+
 static int db_tdb_parse(struct db_context *db, TDB_DATA key,
                        int (*parser)(TDB_DATA key, TDB_DATA data,
                                      void *private_data),
@@ -375,6 +382,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
        result->transaction_start = db_tdb_transaction_start;
        result->transaction_commit = db_tdb_transaction_commit;
        result->transaction_cancel = db_tdb_transaction_cancel;
+       result->exists = db_tdb_exists;
        return result;
 
  fail: