dbwrap: add db_open_trans()
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Mar 2008 15:08:21 +0000 (16:08 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 27 Mar 2008 17:14:56 +0000 (18:14 +0100)
This should be used when transactions are wanted.
For now it's just a wrapper of db_open(), but this
will change.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit 74a070b8a24fea1009e557f711b76fc14e8961dc)

source3/include/dbwrap.h
source3/lib/dbwrap.c

index 095719a01d312fe41b74c3cc42d3db67a44e42bc..654c7a4f7a03f725ebc114bd28336e557f78614f 100644 (file)
@@ -54,6 +54,11 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           int hash_size, int tdb_flags,
                           int open_flags, mode_t mode);
 
+struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
+                                const char *name,
+                                int hash_size, int tdb_flags,
+                                int open_flags, mode_t mode);
+
 struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx);
 
 struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
index 001424a6c0ffe598d5e7ca016d7a03fae79ba822..fd924639a98b8139d910e01fac00a6b5197b6563 100644 (file)
@@ -42,6 +42,9 @@ static int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        return 0;
 }
 
+/**
+ * If you need transaction support use db_open_trans()
+ */
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           const char *name,
                           int hash_size, int tdb_flags,
@@ -93,6 +96,18 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
        return result;
 }
 
+/**
+ * If you use this you can only modify with a transaction
+ */
+struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
+                                const char *name,
+                                int hash_size, int tdb_flags,
+                                int open_flags, mode_t mode)
+{
+       /* TODO: implement this differently */
+       return db_open(mem_ctx, name, hash_size, tdb_flags, open_flags, mode);
+}
+
 NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key)
 {
        struct db_record *rec;