From 7b090b06bf494bcc9bbd080ec2f8761659d8cc6b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Dec 2005 23:40:14 +0000 Subject: r12157: ldb_dump_results() is useful to call from within gdb, so you can see a set of results (This used to be commit 2be62eb2dde9250f8bfe3a3272851e152a1d6b68) --- source4/lib/ldb/common/ldb_msg.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index f4a49e47ce..269599818c 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -671,3 +671,20 @@ time_t ldb_string_to_time(const char *s) return timegm(&tm); } + +/* + dump a set of results to a file. Useful from within gdb +*/ +void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f) +{ + int i; + + for (i = 0; i < result->count; i++) { + struct ldb_ldif ldif; + fprintf(f, "# record %d\n", i+1); + ldif.changetype = LDB_CHANGETYPE_NONE; + ldif.msg = result->msgs[i]; + ldb_ldif_write_file(ldb, f, &ldif); + } +} + -- cgit