summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-12-17 08:53:31 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-19 17:06:03 +0100
commit535311d1875a4302a1c42d92046d2cdc8d3ef4ef (patch)
tree155c6dd9ed10faa3f2833926aa1cf3bb92793e97 /source3/lib
parenta83b327f1bec10f18ebe59c2fde7fe74228149f2 (diff)
downloadsamba-535311d1875a4302a1c42d92046d2cdc8d3ef4ef.tar.gz
samba-535311d1875a4302a1c42d92046d2cdc8d3ef4ef.tar.bz2
samba-535311d1875a4302a1c42d92046d2cdc8d3ef4ef.zip
s3:dbwrap: add dbwrap_delete(), dbwrap_store() and dbwrap_fetch()
The _bystring function are now just tiny wrappers. metze
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/dbwrap.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 73c2761a1b..a57b7c97a5 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -105,12 +105,12 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
return result;
}
-NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key)
+NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key)
{
struct db_record *rec;
NTSTATUS status;
- rec = db->fetch_locked(db, talloc_tos(), string_term_tdb_data(key));
+ rec = db->fetch_locked(db, talloc_tos(), key);
if (rec == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -119,13 +119,13 @@ NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key)
return status;
}
-NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key,
- TDB_DATA data, int flags)
+NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,
+ TDB_DATA data, int flags)
{
struct db_record *rec;
NTSTATUS status;
- rec = db->fetch_locked(db, talloc_tos(), string_term_tdb_data(key));
+ rec = db->fetch_locked(db, talloc_tos(), key);
if (rec == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -135,14 +135,32 @@ NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key,
return status;
}
-TDB_DATA dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx,
- const char *key)
+TDB_DATA dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
+ TDB_DATA key)
{
TDB_DATA result;
- if (db->fetch(db, mem_ctx, string_term_tdb_data(key), &result) == -1) {
+ if (db->fetch(db, mem_ctx, key, &result) == -1) {
return make_tdb_data(NULL, 0);
}
return result;
}
+
+NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key)
+{
+ return dbwrap_delete(db, string_term_tdb_data(key));
+}
+
+NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key,
+ TDB_DATA data, int flags)
+{
+ return dbwrap_store(db, string_term_tdb_data(key), data, flags);
+}
+
+TDB_DATA dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx,
+ const char *key)
+{
+ return dbwrap_fetch(db, mem_ctx, string_term_tdb_data(key));
+}
+