From e0abd1938a05185f09ee99e000783320647a744a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 15 Jun 2012 10:52:07 +0200 Subject: [PATCH] dbwrap: Add dbwrap_fetch_int32 Signed-off-by: Stefan Metzmacher --- lib/dbwrap/dbwrap.h | 2 ++ lib/dbwrap/dbwrap_util.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 6184453812a..5244ff216cf 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 6086ce90ae5..8f2e99744ac 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) {