* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb.h"
#include "tools/cmdline.h"
static int failures;
int i, ret=0, count=0;
struct ldb_cmdline *options;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
+ if (ldb_transaction_start(ldb) != 0) {
+ printf("Failed to start transaction: %s\n", ldb_errstring(ldb));
+ exit(1);
+ }
+
if (options->argc == 0) {
ret = process_file(ldb, stdin, &count);
} else {
}
}
+ if (count != 0 && ldb_transaction_commit(ldb) != 0) {
+ printf("Failed to commit transaction: %s\n", ldb_errstring(ldb));
+ exit(1);
+ }
+
talloc_free(ldb);
printf("Added %d records with %d failures\n", count, failures);