diff options
author | Michael Adam <obnox@samba.org> | 2009-09-20 23:58:27 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-09-21 17:47:51 +0200 |
commit | 91e1bab2e9a3f33151061554f2dcf05bcb728312 (patch) | |
tree | df719d40a81705791977bd20b5c68253ada28b55 /lib/tdb/tools | |
parent | 817383d88d820e7be5b5dd3d2da350d4a03a94de (diff) | |
download | samba-91e1bab2e9a3f33151061554f2dcf05bcb728312.tar.gz samba-91e1bab2e9a3f33151061554f2dcf05bcb728312.tar.bz2 samba-91e1bab2e9a3f33151061554f2dcf05bcb728312.zip |
tdb:tdbtool: add transaction_start/_commit/_cancel commands.
So one can perform tdbtool operations protected by transactions.
Michael
Diffstat (limited to 'lib/tdb/tools')
-rw-r--r-- | lib/tdb/tools/tdbtool.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index 52c901f4e8..193140b801 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -40,6 +40,9 @@ static int disable_mmap; enum commands { CMD_CREATE_TDB, CMD_OPEN_TDB, + CMD_TRANSACTION_START, + CMD_TRANSACTION_COMMIT, + CMD_TRANSACTION_CANCEL, CMD_ERASE, CMD_DUMP, CMD_INSERT, @@ -70,6 +73,9 @@ typedef struct { COMMAND_TABLE cmd_table[] = { {"create", CMD_CREATE_TDB}, {"open", CMD_OPEN_TDB}, + {"transaction_start", CMD_TRANSACTION_START}, + {"transaction_commit", CMD_TRANSACTION_COMMIT}, + {"transaction_cancel", CMD_TRANSACTION_CANCEL}, {"erase", CMD_ERASE}, {"dump", CMD_DUMP}, {"insert", CMD_INSERT}, @@ -169,6 +175,9 @@ static void help(void) "tdbtool: \n" " create dbname : create a database\n" " open dbname : open an existing database\n" +" transaction_start : start a transaction\n" +" transaction_commit : commit a transaction\n" +" transaction_cancel : cancel a transaction\n" " erase : erase the database\n" " dump : dump the database as strings\n" " keys : dump the database keys as strings\n" @@ -575,6 +584,18 @@ static int do_command(void) return 0; } switch (mycmd) { + case CMD_TRANSACTION_START: + bIterate = 0; + tdb_transaction_start(tdb); + return 0; + case CMD_TRANSACTION_COMMIT: + bIterate = 0; + tdb_transaction_commit(tdb); + return 0; + case CMD_TRANSACTION_CANCEL: + bIterate = 0; + tdb_transaction_cancel(tdb); + return 0; case CMD_ERASE: bIterate = 0; tdb_traverse(tdb, do_delete_fn, NULL); |