summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/ldbmodify.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-12-16 14:39:42 +1100
committerAndrew Tridgell <tridge@samba.org>2008-12-16 14:39:42 +1100
commitf320e3a659d2ef701e3770071375ca9781d98325 (patch)
tree6111488b1156e5a22a470aa50f432ad202f2c1a2 /source4/lib/ldb/tools/ldbmodify.c
parent936d76802f98d04d9743b2ca8eeeaadd4362db51 (diff)
downloadsamba-f320e3a659d2ef701e3770071375ca9781d98325.tar.gz
samba-f320e3a659d2ef701e3770071375ca9781d98325.tar.bz2
samba-f320e3a659d2ef701e3770071375ca9781d98325.zip
use transactions in ldbadd, ldbmodify and ldbedit
The command line tools ldbadd, ldbmodify and ldbedit should operate within a transaction to make them more efficient. The ldbadd tool in particular is much faster when adding a large number of records if all the adds happen within a transaction. Previously there was a transaction per record.
Diffstat (limited to 'source4/lib/ldb/tools/ldbmodify.c')
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index 6e355a10cf..8b6309e016 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -91,6 +91,11 @@ int main(int argc, const char **argv)
ldb = ldb_init(NULL, NULL);
+ if (ldb_transaction_start(ldb) != 0) {
+ printf("Failed to start transaction\n");
+ exit(1);
+ }
+
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc == 0) {
@@ -108,6 +113,11 @@ int main(int argc, const char **argv)
}
}
+ if (count != 0 && ldb_transaction_commit(ldb) != 0) {
+ printf("Failed to commit transaction\n");
+ exit(1);
+ }
+
talloc_free(ldb);
printf("Modified %d records with %d failures\n", count, failures);