summaryrefslogtreecommitdiff
path: root/ldb/tools/ldbadd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldb/tools/ldbadd.c')
-rw-r--r--ldb/tools/ldbadd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ldb/tools/ldbadd.c b/ldb/tools/ldbadd.c
index 15376e73..f32a4fa9 100644
--- a/ldb/tools/ldbadd.c
+++ b/ldb/tools/ldbadd.c
@@ -92,6 +92,11 @@ int main(int argc, const char **argv)
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 {
@@ -108,6 +113,11 @@ int main(int argc, const char **argv)
}
}
+ 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);