summaryrefslogtreecommitdiff
path: root/lib/dbwrap
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-06-15 10:52:07 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-22 15:16:47 +0200
commite0abd1938a05185f09ee99e000783320647a744a (patch)
tree4bc5db2e4ce810f88f3c1bc3299730b8428ac616 /lib/dbwrap
parentce7b0b9906685740e18c599cb3b453f58c8565d1 (diff)
downloadsamba-e0abd1938a05185f09ee99e000783320647a744a.tar.gz
samba-e0abd1938a05185f09ee99e000783320647a744a.tar.bz2
samba-e0abd1938a05185f09ee99e000783320647a744a.zip
dbwrap: Add dbwrap_fetch_int32
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/dbwrap')
-rw-r--r--lib/dbwrap/dbwrap.h2
-rw-r--r--lib/dbwrap/dbwrap_util.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index 6184453812..5244ff216c 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -93,6 +93,8 @@ NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key,
NTSTATUS dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx,
const char *key, TDB_DATA *value);
+NTSTATUS dbwrap_fetch_int32(struct db_context *db, TDB_DATA key,
+ int32_t *result);
NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
int32_t *result);
NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c
index 6086ce90ae..8f2e99744a 100644
--- a/lib/dbwrap/dbwrap_util.c
+++ b/lib/dbwrap/dbwrap_util.c
@@ -26,8 +26,8 @@
#include "dbwrap.h"
#include "lib/util/util_tdb.h"
-NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
- int32_t *result)
+NTSTATUS dbwrap_fetch_int32(struct db_context *db, TDB_DATA key,
+ int32_t *result)
{
TDB_DATA dbuf;
NTSTATUS status;
@@ -36,7 +36,7 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
return NT_STATUS_INVALID_PARAMETER;
}
- status = dbwrap_fetch_bystring(db, talloc_tos(), keystr, &dbuf);
+ status = dbwrap_fetch(db, talloc_tos(), key, &dbuf);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -51,6 +51,12 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
return NT_STATUS_OK;
}
+NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
+ int32_t *result)
+{
+ return dbwrap_fetch_int32(db, string_term_tdb_data(keystr), result);
+}
+
NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
int32_t v)
{